--目标表,更新或者插入此表
merge into emp2 a using
(select * from emp) b
--匹配条件
on (a.empno = b.empno)
--匹配时更新目标表
when matched then
update set a.sal = b.sal
--不匹配时插入到目标表
when not matched then
insert (empno , ename, job, mgr, hiredate, sal, comm, deptno)
values (b.empno, b.ename, b.job, b.mgr, b.hiredate, b.sal, b.comm, b.deptno);
Oracle中merge into using 用法
最新推荐文章于 2024-03-22 10:59:17 发布