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: Christopher Spence <cspence_at_FuelSpot.com>
Date: Mon, 27 Aug 2001 09:50:21 -0700
Message-ID: <F001.003786EC.20010827100109@fatcity.com>

That won't work, your primary key is 3 cols, so the foreign key must reference those same three cols.

"Do not criticize someone until you walked a mile in their shoes, that way when you criticize them, you are a mile a way and have their shoes."

Christopher R. Spence
Oracle DBA
Phone: (978) 322-5744
Fax: (707) 885-2275

Fuelspot
73 Princeton Street
North, Chelmsford 01863  

-----Original Message-----
Sent: Monday, August 27, 2001 12:17 PM
To: Multiple recipients of list ORACLE-L

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: RICHARD.T.CALE_at_saic.com

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: ListGuru_at_fatcity.com (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).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Christopher Spence
  INET: cspence_at_FuelSpot.com
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: ListGuru_at_fatcity.com (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). Received on Mon Aug 27 2001 - 11:50:21 CDT

Original text of this message

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