We help IT Professionals succeed at work.

merge stmt in oracle

I'm trying to write a merge stmt for oracle.  i'm trying to merge tableA t when not matched then insert when matched then update.  what would be the syntax for oracle?  thank you.
Comment
Watch Question

EE Topic Advisor
Most Valuable Expert 2014
Awarded 2013
Commented:
MERGE INTO tableA A
   USING (SELECT employee_id, salary, department_id 
          FROM employees
          WHERE department_id = 80) S
          ON (A.employee_id = S.employee_id)

   WHEN MATCHED THEN UPDATE SET A.bonus = A.bonus + S.salary*.01

   WHEN NOT MATCHED THEN INSERT (A.employee_id, A.bonus)
     VALUES (S.employee_id, S.salary*0.1)
     WHERE (S.salary <= 8000)
;

Open in new window


This is a slightly reworked variant from a MERGE documentation page. You don't provide much detail in the question so this example realtes to "employees" information