oracle 中merage语句,实例语句如下
MERGE INTO employees e
USING new_hires n
ON (e.employee_id = n.employee_id)
WHEN MATCHED THEN
UPDATE SET e.department_id = n.department_id, e.salary = n.salary
WHEN NOT MATCHED THEN
INSERT (employee_id, department_id, salary) VALUES (n.employee_id, n.department_id, n.salary);
在WHEN MATCHED THEN后的update语句中不允许更新on后条件中的字段,否则会报错