我只是在脑海中写下了这个,但是如果您必须使用简单的sql来做的话,这应该是个主意。
insert into restaurant(x, y)values select valuex, valuey from dual where not exists( select 1 from restaurant where name = 'restaurantname')
编辑: 同样,我无法解析它,但您可能可以使用WITH子句:
with validation as( select 1 from restaurant where name = 'restaurantname')insert into restaurant(x, y)values ( select value1x, value1y from dual where validation.v = 1), ( select value2x, value2y from dual where validation.v = 1)



