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 references two different table?

Re: foreign key references two different table?

From: <Kenneth>
Date: Sat, 31 May 2003 07:58:30 GMT
Message-ID: <3ed85f75.1876458@news.inet.tele.dk>


On 30 May 2003 15:13:48 -0700, susana73_at_hotmail.com (Susan Lam) wrote:

>I have 3 tables.
>
>parent1 (id, ...)
>parent2 (id, ...)
>child (id, memberid, type)
>
>child.memberid came from parent1.id and parent2.id. child.type
>distinguishs where the memberid are from parent1 or parent2 table.
>
>I would like to have a fk relationship between child.memberid ->
>parent1.id and parent2.id. However, I can't create two separate fks
>because parent1.id and parent2.id together are not unique.
>
>Is there a way to create one fk to two different tables?
>
>Thanks.
>Susan

Hi Susan,

Not by means of foreign key constraints.....you can either

  1. Let a trigger do the job for you.
  2. Review your data model to find a more "clean" relational solution, if at all possible....
    • Kenneth Koenraadt
Received on Sat May 31 2003 - 02:58:30 CDT

Original text of this message

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