Oracle插入if not exists语句

insert into OPT (email,campaign_id) values('mom@cox.net',100)
where not exists( select * from OPT where (email ="mom@cox.net" and campaign_id =100)) ;

Error report: SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 – “SQL command not properly ended”
*Cause:
*Action:

如何在Oracle中不存在新行?

insert into OPT (email,campaign_id) 
select 'mom@cox.net',100
from dual
where not exists(select * 
                 from OPT 
                 where (email ="mom@cox.net" and campaign_id =100));

相关文章

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注