Adding Ref. Integrity
From: Simon Thompson <scthomp_at_ibm.net>
Date: 1995/07/19
Message-ID: <3uibdl$2ftm_at_news-s01.ny.us.ibm.net>#1/1
| Simon Thompson
| Christchurch
| New Zealand
Received on Wed Jul 19 1995 - 00:00:00 CEST
Date: 1995/07/19
Message-ID: <3uibdl$2ftm_at_news-s01.ny.us.ibm.net>#1/1
The child table has several fields also. The key ones are:
C_NUMBER VARCHAR2(7) C_MONTH VARCHAR2(4)
Its primary key is a composite key, C_NUMBER and C_MONTH.
I have checked that all values in C_NUMBER exist in P_NUMBER, and they do.
The code for the constraint is (from memory, its at work):
alter table CHILD
add (constraint CP_NUMBER
foreign key (C_NUMBER)
references Parent (P_NUMBER);
TIA.
+---------------------------
| Simon Thompson
| Christchurch
| New Zealand
Received on Wed Jul 19 1995 - 00:00:00 CEST