Re: Adding Ref. Integrity

From: Michael Nolan <nolan_at_helios.unl.edu>
Date: 1995/07/19
Message-ID: <3ujrqr$ai3_at_crcnis3.unl.edu>#1/1


scthomp_at_ibm.net (Simon Thompson) writes:

>alter table CHILD
> add (constraint CP_NUMBER
> foreign key (C_NUMBER)
> references Parent (P_NUMBER);

Have you tried checking the table using:

   select * from child a where not exists (select 'x' from parent b    where b.p_number = a.c_number)

This should display the problem rows in your child table. (problem child?)

I had a problem like this once that turned out to be caused by trailing blanks in a varchar2 column. The data LOOKED fine, but Oracle didn't like it.

---
Michael Nolan, Sysop for the DBMS RoundTable on GEnie
nolan_at_tssi.com, dbms_at_genie.com, nolan_at_inetnebr.com
(posted from nolan_at_helios.unl.edu)
Received on Wed Jul 19 1995 - 00:00:00 CEST

Original text of this message