本文介绍了Oracle插入(如果不存在)语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

insert into OPT (email, campaign_id) values('[email protected]',100)
where not exists( select * from OPT where (email ="[email protected]" and campaign_id =100)) ;

如果Oracle中不存在新行,如何插入?

how to insert a new row if it doesn't exists in Oracle?

推荐答案

insert into OPT (email, campaign_id)
select '[email protected]',100
from dual
where not exists(select *
                 from OPT
                 where (email ="[email protected]" and campaign_id =100));

这篇关于Oracle插入(如果不存在)语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 21:52