前言:
当前咱们对“oracle插入数据”大体比较关注,看官们都想要分析一些“oracle插入数据”的相关资讯。那么小编同时在网摘上网罗了一些关于“oracle插入数据””的相关知识,希望咱们能喜欢,各位老铁们快快来了解一下吧!oracle merge into使用(更新,插入)
select * from products;查询结果
productid,reqno,productName,category
1,001,产品name,CCA
执行merge into
merge into products ausing (select 1 productid,'001' reqno from dual) bon (a.productid=b.productid and a.reqno=b.reqno)when matched then update set productName='new name',category='new category'when not matched then insert (productid,reqno,productName,category) values (1,'002','新产品','CCA');
select * from products;查询结果(执行了更新)
productid,reqno,productName,category
1,001,new name,new category
执行merge into
merge into products ausing (select 1 productid,'002' reqno from dual) bon (a.productid=b.productid and a.reqno=b.reqno)when matched then update set productName='new name',category='new category'when not matched then insert (productid,reqno,productName,category) values (1,'002','新产品','CCA');
select * from products;查询结果(执行了插入)
productid,reqno,productName,category
1,001,new name,new category
1,002,新产品,new CCA
2021-10-21
标签: #oracle插入数据