SQL Tutorial : DML - MERGE
Let's learn about next topic: MERGE
MERGE:
*******
- CONDITIONAL UPDATE OR INSERT :
- MERGE INTO COPY_EMP C
USING EMPLOYEES E
ON(E.EMPLOYEE_ID=C.EMPLOYEE_ID)
WHEN MATCHED THEN
UPDATE SET C.LAST_NAME=UPPER(E.LAST_NAME),
C.SALARY=E.SALARY ,
C.JOB_ID=INITCAP(E.JOB_ID)
WHEN NOT MATCHED THEN
INSERT VALUES
(E.EMPLOYEE_ID,'Mr.'||E.LAST_NAME,E.SALARY,E.JOB_ID)
No comments:
Post a Comment