Oracle Merge into 简单用法

时间:2021-05-24 08:28:00   收藏:0   阅读:0
merge into ZQ_A A 
using ZQ_B b on (a.name=b.name)
when matched then 
  update set a.age=b.age 
when not matched then 
  insert  (a.name,a.age) values(b.name,b.age);    -- 都可以省略 表名,因为表都是 第一个表



merge into ZQ_A A 
using ZQ_B b on (a.name=b.name)
when matched then  
  update  set a.age = a.age   -- 注意 delete之前要先update  非 on里面条件的栏位
  delete   where a.name= b.name;

  

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!