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

Home -> Community -> Usenet -> c.d.o.tools -> Re: ForeignKey constraint

Re: ForeignKey constraint

From: Christopher Maher <ChristopherMaher_at_Hotmail.com>
Date: Tue, 13 Feb 2001 13:53:52 -0500
Message-ID: <3A8982C0.2042554B@Hotmail.com>

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

Original text of this message

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