You can only FK to field(s) that are unique or primary key constraints.
 
if col1 is unique, you can put a unique constraint on it and then FK to it from the child.
 
your only other choice is to do FK checkign via triggers(i did it for distributed databases, where parents were on one db and children were on other, efficient NO but it was a requirement).
 
joe


>>> [EMAIL PROTECTED] 08/27/01 12:17PM >>>
Hi DBAs,

Table1 PK is on columns col1,col2,col3
I want to create a FK on table2 to table1 for col1.

What is the alternative to
ALTER TABLE table2
ADD CONSTRAINT fk_table2
FOREIGN KEY (col1) REFERENCES table1(col1);

I always get ORA-2270: No matching unique or primary key for this
column-list.
Every value for table2.col1 is in the table table1.col1. I want to enforce
this at the database server level.

Thanks
Rick

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Cale, Rick T (Richard)
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to