Re: Strange contraint help please...

From: Rajarao <rbandu_at_bear.com>
Date: 29 Nov 2001 09:59:20 -0800
Message-ID: <5784d099.0111290959.6dfb05e9_at_posting.google.com>


Harry,

        The simplest and feasible solution to your problem is to MOVE the key elements of the tables A & B into another "KEY GENERATION" table and to use it in the FK constraints in all the three tables. This is because of the fact that the FOREIGN KEY constraint for a table can have only one table PK source.

Raj B.

harry <a_at_abc.com> wrote in message news:<vo2c0uooh12rrv7bsfssqk1coshe0om60r_at_4ax.com>...
> Using Oracle 8i on win NT 4 server(sp6a)
>
> How can I get around this problem? - I have 3 tables with one column each -
>
> A
> =
> ID number(8)
>
> B
> =
> ID number(8)
>
> C
> =
> ID number(8)
>
>
> containin data
>
> A
> =
> 1
> 2
> 3
>
> C
> =
> 4
> 5
> 6
>
> B
> =
> 1
> 2
> 3
> 4
> 5
> 6
>
> how can I add a referential integrity constraints to table B that ensures the values exist in tables
> A OR C ?
>
> This code below fails as 4,5,6 are in table B -
>
> ALTER TABLE b ADD CONSTRAINT A_FK
> FOREIGN KEY (ID)
> REFERENCES a (ID) ;
>
>
> Any ideas?
>
> thanks
>
> harry
Received on Thu Nov 29 2001 - 18:59:20 CET

Original text of this message