Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: ForeignKey constraint
Hi,
How could you have one field referencing two others? If you are trying to reference 5_3 to 1_1 you can use a foreign key to do that..also, you can reference 5_3 to 1_2 with a second foreign key if you want..I'm unclear exactly on how your data is set up..do 1_1 and 1_2 hold the same data? (like employee# and mgr# for instance?) If that's the case use 2 foreign keys.
Hth,
Steve
In article <9684q2$1a6$1_at_news.cscoms.com>,
"Actiris" <actiris_at_cscoms.com> wrote:
> Can't find the correct way to define a foreign key constraint which
refers
> to 2 fields.
>
> Table1: (PrimaryKey are 2 Fields)
> Field1_1 constraint CFK_Field1 references TableX(FieldX)
> Field1_2
> Field1_3
> constraint CPR_Key1 primary key (Field1_1, Field1_2) );
>
> Table5:
> Field5_1
> Field5_2
> Field5_3 constraint CFK_Field5_3 references TABLE1(Field1_1,
Field1_2) );
> ----->> This doesn't work because there can be only one field be
> referenced. How to do it otherwise?
>
> Many thanks in advance
> Beat
>
> --
> +++
> Beat Christen actiris_at_loxinfo.co.th
> Phuket/Thailand
> +++
>
>
Sent via Deja.com
http://www.deja.com/
Received on Mon Feb 12 2001 - 08:06:58 CST