Oracle insert if not exists statement

后端 未结 5 793
长发绾君心
长发绾君心 2020-11-27 19:46
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)) ;
         


        
5条回答
  •  青春惊慌失措
    2020-11-27 20:38

    The correct way to insert something (in Oracle) based on another record already existing is by using the MERGE statement.

    Please note that this question has already been answered here on SO:

    • oracle insert if row not exists
    • insert if not exists oracle

提交回复
热议问题