merge into
begin
merge into emp_test a using emp b on (a.empno=b.empno)
when matched then
update set a.comm=b.comm
when not matched then
insert values(b.empno,b.ename,b.job,b.mgr,b.hiredate,b.sal,b.comm,b.deptno);
delete from emp_test where empno not in(select empno from emp);
dbms_output.put_line('delete from emp_test where empno not in(select empno from emp)');--目标表存在,原表emp不存在,则删除
commit;
end;