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

From: Victor M. <eh936_at_hotmail.com>
Date: Tue, 08 Jul 2003 21:20:09 GMT
Message-ID: <MPG.1974ff3ae0a73925989680_at_nntp.slnt.phub.net.cable.rogers.com>


In article <3086703.1057683624_at_dbforums.com>, member14183_at_dbforums.com says...
>
> 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
>

Thanks for the follow up. I'm not quite sure how to handle the DEFERABLE INITIALLY DEFERRED keywords but when I try the above statement :

"ALTER TABLE EMPLOYEES MODIFY CONSTRAINT DNO DISABLE" in SQL*Plus I get the error as follows:

ORA-00905: missing keyword

I've tried searching the web for answers but can't find anything relevant on this error. Can someone tell me what I'm doing wrong...? The only relevant link I found was here:

http://www.oracle-base.com/Articles/8i/ConstraintCheckingUpdates.asp

Thanks for all the help.

Victor Received on Tue Jul 08 2003 - 23:20:09 CEST

Original text of this message