Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: ForeignKey constraint
Hi Actiris,
Table1 is your parent table and the child table is Table5. Your primary key in Table1 uses two columns. You are trying to constrain your child table with a foreign key into Table1. However, the foreign key in your child table is trying to map one column, Field5_3, into the two-column primary key of the parent table. The number of columns in the child table foreign key must match the number of columns in the parent table primary key.
Is there another field in Table5 that maps to either Field1_1 or Field1_2? Suppose Field5_2 maps to Field1_1 and Field5_3 maps to Field1_2. Then you could create this foreign key constraint:
constraint CFK_Field5_2_Field5_3
foreign key (Field5_2, Field5_3)
references TABLE1 (Field1_1, Field1_2)
Good luck.
Chris Received on Tue Feb 13 2001 - 12:53:52 CST
![]() |
![]() |