Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Foreign Key Problem
You will have to build a trigger to do this -- foreign keys by definition must be composed of the entire primary key of the table they reference
Rachel
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
![]() |
![]() |