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

Home -> Community -> Usenet -> c.d.o.server -> Re: Foreign Key Problem

Re: Foreign Key Problem

From: Manjula Krishnan <krishnan_at_mailhost.tcs.tulane.edu>
Date: 1998/02/20
Message-ID: <34EDE3CE.E6E6624E@mailhost.tcs.tulane.edu>#1/1

Your table 2 has a primary key comprised of 3 columns, so the foreign key in table 1 should also be comprised of 3 columns.

DINFA - Microcentro wrote:

> Hi
> I have two tables created as follow.
>
> Table1 Columns T1Cod1 varchar2(3) NOT NULL Primary Key
> T1Cod2 varchar2(3) NOT NULL
> T1Cod3 varchar2(3) NOT NULL
>
> Table2 Columns T2Cod1 varchar2(3) NOT NULL Primary Key
> T2Cod2 varchar2(3) NOT NULL Primary Key
>
> T2Cod3 varchar2(3) NOT NULL Primary Key
>
> I'd like to create a relationship between two tables as follow
>
> ALTER TABLE Table1 CONSTRAINT XPTO_FK
> FOREIGN KEY (T1Cod2,T1Cod3)
> REFERENCES Table2 (T2Cod1,T2Cod3)
>
> i.e. only the Columns T2Cod1 and T2Cod3 From Table2 are the Key
> Components of Foreign Key.
> When i try this an error occurs
> ORA-02270: No matching unique or Primary Key for this Column List.
>
> Is there any way to do that.
>
> Thanks in Advence
> Joe
Received on Fri Feb 20 1998 - 00:00:00 CST

Original text of this message

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