Oracle SQL - DELETE is failed due to constraint violations

Introduction

The following code shows that a DELETE is failed due to constraint violations.

The DELETE fails because rows exist in a child table.

DELETE FROM emp
    WHERE deptno IN (SELECT deptno
                     FROM   departments
                     WHERE  location = 'NEW YORK');
DELETE FROM emp
*
ERROR at line 1:
ORA-02292: integrity constraint (BOOK.D_MGR_FK) violated - child record found

Related Topic