if not exists...insert...如何改成oracle写法?
来源:百度知道 编辑:UC知道 时间:2024/09/21 13:36:15
if not exists(select * from tablename where colname='***')
insert into tablename values('','','','','')
这是sql语句,在oracle里应该怎么写?
insert into tablename values('','','','','')
这是sql语句,在oracle里应该怎么写?
刚才找到一个更好的方法:
insert when (not exists (select * from tablename where colname = '***')) then
into tablename select '', '', '', '', '' from dual
insert into table select * from table1 where Not Exists (select * from table)
其实就这么简单!
祝你好运
if not exists(select * from tablename where colname='***') then
insert into tablename values('','','','','') ;
end if;