Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: PK/Fk question

Re: PK/Fk question

From: JOE TESTA <JTESTA_at_longaberger.com>
Date: Mon, 27 Aug 2001 10:06:20 -0700
Message-ID: <F001.0037868C.20010827100105@fatcity.com>

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
>>> RICHARD.T.CALE_at_saic.com 08/27/01 12:17PM
>>>Hi DBAs,Table1 PK is on columns col1,col2,col3I want
to create a FK on table2 to table1 for col1.What is the alternative toALTER TABLE table2ADD CONSTRAINT fk_table2FOREIGN KEY (col1) REFERENCES table1(col1);I always get ORA-2270: No matching unique or primary key for thiscolumn-list. Every value for table2.col1 is in the table table1.col1. I want to enforcethis at the database server level.ThanksRick-- Please see the official ORACLE-L FAQ: http://www.orafaq.com-- Author:
Cale, Rick T (Richard)  INET: RICHARD.T.CALE_at_saic.comFat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051San Diego, California        -- Public Internet access / Mailing

Lists--------------------------------------------------------------------To 
REMOVE yourself from this mailing list, send an E-Mail messageto: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and inthe message BODY, include a line containing: UNSUB ORACLE-L(or the name of mailing list you want to be removed from).  You mayalso send the HELP command for other information (like subscribing). Received on Mon Aug 27 2001 - 12:06:20 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US