sql/plus: Constraint & 'pseudo' Foreign Keys

From: Noah B. Hart <noah_at_lipman.com>
Date: 1996/11/01
Message-ID: <01bbc818$e7f53e00$23a99ecd_at_Redwood.lipman.com>#1/1


(Reposted according to new charter)

The problem:
How to add a constraint to Address, requiring that the field P_SSN exist in Profiles.

Background:
 I have 3 tables, Profiles, Notes and Addresses  

 P has the columns SSN, seq, LastName, Firstname  N has the columns P_SSN, P_SEQ, ENTRY, etc  A has the columns P_SSN, UPDATED, etc  

 P has the Primary Key SSN, SEQ
 N has the Primary Key P_SSN, P_SEQ, ENTRY  A has the Primary Key P_SSN, UPDATED  

 (P has all the family members as sequences under the  primary SSN)  

 N has the Foreign Key constraint,
 REFERENCES Profiles (SSN, seq)
 since Notes are associated with a specific family member.  

Note:
I cannot use a Foreign key, since A does not have the p_seq field  

Any Ideas,  

 --
 Noah B. Hart
Systems Administrator Received on Fri Nov 01 1996 - 00:00:00 CET

Original text of this message