Oracle
Violating Constraint
Figo Kim
2006. 11. 23. 22:13
UPDATE employees
SET department_id = 55
WHERE department_id = 110;
SET department_id = 55
WHERE department_id = 110;
UPDATE employees
*
ERROR at line 1:
ORA-02291: integrity constraint (HR.EMP_DEPT_FK)
violated - parent key not found
Department 55 doesn't exist in the parent table.
You cannot delete a row that contains a primary key that is used as a foreign key in another table.
DELETE FROM departments
WHERE department_id = 60;
WHERE department_id = 60;
DELETE FROM department
*
ERROR at line 1:
ORA-02292: integrity constraint (HR.EMP_DEPT_FK)
violated - child record found