ORA-02291: integrity constraint violated - parent key not found
OracleWhat does it mean?
A foreign key constraint was violated. No parent row was found corresponding to the value inserted into the child table; that is, the referenced record does not exist.
Why does it happen?
An INSERT/UPDATE referencing a nonexistent parent record, the parent table row not inserted yet, the wrong load order (child before parent), or the match failing due to case or whitespace differences.
How to fix it
Insert the relevant record into the parent table first, then into the child table. Verify that the reference exists: SELECT * FROM parent_table WHERE key_col = value; In bulk loads, process tables in the correct order (parent first). To find the violating row, compare the value in the child table with the parent table using NOT IN / an anti-join.
More from this engine
- ORA-00604error occurred at recursive SQL level
- ORA-01438value larger than specified precision allowed for this column
- ORA-01400cannot insert NULL into (column)
- ORA-02292integrity constraint violated - child record found
- ORA-00979not a GROUP BY expression
- ORA-00918column ambiguously defined
- ORA-06550line/column PLS-... PL/SQL compilation error