top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to update or insert row using single condition?

+2 votes
192 views
How to update or insert row using single condition?
posted Sep 23, 2014 by Archana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

MERGE INTO dept d
USING emp e
ON (d.deptno = e.deptno)
WHEN MATCHED
THEN
UPDATE SET d.name = e.ename,
d.job = e.job,
d.salary = e.salary,
d.deptno = e.deptno
WHEN NOT MATCHED
THEN
INSERT VALUES (e.ename,
e.job,
e.salary,
e.deptno);

answer Sep 24, 2014 by Arun Gowda
...