原句子

1merge into dept a using dept_bak b on (a.deptno=b.deptno)
when matched then
update set a.dname=b.dname,
a.loc=b.loc
when not matched then
insert (deptno,dname,loc)values(b.deptno,b.dname,b.loc);//这里字段不需要标记表别名

然后使用dblink

merge into dept a using dept@link_orcl b on (a.deptno=b.deptno)
when matched then
update set a.dname=b.dname,
a.loc=b.loc
when not matched then
insert (deptno,dname,loc)values(b.deptno,b.dname,b.loc);

哈哈是不是超级简单,按理说dblink也可以放前面,那就是改动对方的表了,回去试试

posted on 2020-01-10 16:39  我有我的信仰  阅读(55)  评论(0)    收藏  举报