hi,
I used the following statement in two different files and tries to execute two SQL files, which one would be faster and why?
1 ->
Code:
merge into abc.emp1 a
using abc.emp b
on
(
a.empno=b.empno
)
when matched then
update set
ename=b.ename,
sal=b.sal
when not matched then
insert (empno,ename,sal)
values(b.empno,b.ename,b.sal);
2->
merge into abc.emp1 a
using abc.emp b
on
(
a.empno=b.empno
)
when matched then
update set
ename=b.ename,
sal=b.sal;
insert into abc.emp1 a
select empno,ename,sal
from
abc.emp
where not exists(select 1 from abc.emp where empno=a.empno);