i have 2 simple table
CREATE TABLE employee (
emp_id INT PRIMARY KEY,
first_name VARCHAR(40),
last_name VARCHAR(40),
birth_day DATE,
sex VARCHAR(1),
salary INT,
super_id INT,
branch_id INT
);
CREATE TABLE biodata (
emp_id INT PRIMARY KEY,
first_name VARCHAR(40),
last_name VARCHAR(40),
birth_day DATE,
sex VARCHAR(1)
);
i want to merge it
merge into biodata c
using employee e
on (c.emp_id = e.emp_id)
when matched then
update set
c.emp_id=e.emp_id,
c.first_name=e.first_name,
c.last_name=e.last_name,
c.birth_day=e.birth_day,
c.sex=e.sex
when not matched then
insert VALUES(e.emp_id,e.first_name,e.last_name,e.birth_day,e.sex);
but Oracle says:
ORA-38104: Columns referenced in the ON Clause cannot be updated: c.emp_id