Re: ORA-02291: integrity constraint (%%%) violated - parent key not found

From: andrewst <member14183_at_dbforums.com>
Date: Tue, 08 Jul 2003 17:00:24 +0000
Message-ID: <3086703.1057683624_at_dbforums.com>


Originally posted by Victor M .
> 1. For the SSN field...do I have to take into consideration the
> terminator character at the end ? I suppose that is what you
> mean by the
> added 0 at the end of the string '1234567890' ?
>

No, Ana must have misread your insert! The SSN value '123456789' is fine.

Originally posted by Victor M .
> 2. Would you tell me if this sounds right on disabling the Foreign Key
> constraint in the Employees Table.
>
> ALTER TABLE EMPLOYEES MODIFY CONSTRAINTS DNO DISABLE NOVALIDATE
>

ALTER TABLE EMPLOYEES MODIFY CONSTRAINT DNO DISABLE; .. insert the data
ALTER TABLE EMPLOYEES MODIFY CONSTRAINT DNO ENABLE; If there is an ongoing need to deal with this Catch 22 situation, you might want to change one (or both) of the foreign keys to DEFERRABLE INITIALLY DEFERRED. That way it is only checked when you commit. However, I suspect in practice it is only in the initial data load that you are likely to want to create a department with a manager who doesn't exist yet, or an employee with a department that doesn't exist yet.

--
Posted via http://dbforums.com
Received on Tue Jul 08 2003 - 19:00:24 CEST

Original text of this message