Referencing foreign key

From: Maoz Mussel <mmussel_at_iil.intel.com>
Date: Wed, 08 Jul 1998 13:55:54 +0300
Message-ID: <35A3503A.856A8EAE_at_iil.intel.com>



[Quoted] Hi there,

I have the following problem/question:

I have table temp1 with the following fields: x,y,z, where (x,y,z) is the primary key.
Also, I have table temp2 with y,z and some other fields.

When trying to create the following CONSTRAINT: ALTER TABLE temp2 ADD CONSTRAINT zy_fkey FOREIGN KEY (y,z)   REFERENCES temp1 (y,z);

I get this error message:
ORA-02270: no matching unique or primary key for this column-list

Which caused since I don't have (y,z) as unique/promary key on temp1. Still, I want to assure that y,z won't be inserted into temp2, unless this
couple exist on temp1 (there could be more than one instance of this couple exist on temp1).

Any idea how to do it right ??

TIA,
Maoz
mmussel_at_iil.intel.com Received on Wed Jul 08 1998 - 12:55:54 CEST

Original text of this message