Re: Newbie problem figuring out parent/child problems

From: <M.Verwey_at_inter.nl.net>
Date: 1996/01/29
Message-ID: <4ej73c$s38_at_altrade.nijmegen.inter.nl.net>#1/1


general delivery <disc_at_iwaynet.net> wrote:

>While creating test data for a new database, I spend frustrating hours
>trying to resolve the following messages:
 

>Record ##: Rejected Eror on table table_name
>ORA-02291: integrity constraint (dbname.SYS_C########) violated - parent
>key not found
 

>The test database I am created represents a business medical system. The
>tables have quite a few foreign keys linking to other tables. It takes
>me forever to manually review each foreign key to see which one I
>mis-typed.
 

>I've looked in the Oracle manual set and learned that the SYS_C########
>is defined in system tables. I can see that the SYS_C######## is defined
>to the table_name but I can't find the magic system table that tells me
>which of the foreign keys SYS_C######## relates to. If someone could
>help me out, it would help me through a very frustrating manual process.

It seems me logically that you know the relations between the tables. When you know these you can disable all the foreign keys. Then you can fill your test database and
enable the foreign keys again. Then you can for the table, which cause your problem, subtract the
parent table from the child table. The records which are the result of these subtraction will give you
the mistyped foreign keys.
For example: you have a DEPT table and a EMP table. In the EMP table there is a column dept_no
which references dept_no from the DEPT table. The following select will give you all dept_no from
the EMP table, which aren't in the DEPT table: select dept_no from emp minus select dept_no from dept Received on Mon Jan 29 1996 - 00:00:00 CET

Original text of this message