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: Inherit compound key

Re: Inherit compound key

From: Alexander Poeppl <alp_at_inode.muc.de>
Date: 1997/12/31
Message-ID: <34AA762E.F5B92455@inode.muc.de>#1/1

Ulrich Brandes schrieb:
>
 

> Hi,
>
 

> I have the following problem while using Designer/2000:
>
 

> I have two tables with a two columns compound primary key. Both tables
> have one key component (MANDANT) in common. I have an additional Table
> which should act as an intersection table between these two tables. If
 I
> try to inherit the compound keys to the intersection table I get a
> compound key with four columns instead of three. But I want a only thre
 e
> column based compound key on that intersection table, based on the fact
 

> that an insert on the intersection table should only be possible if the
 

> mandant exits in both tables. Is it possible to define a constraint for
 

> this or is it necessary to handle that situation via a program routine.
 

>
 

> Thanks in advance...
>
 

> Ulrich

Hi Ulrich,

let s assume the following:
Table A has the primary key (MANDANT, PK A). Table C has the primary key (MANDANT, PK C).

So you define the primary key for the intersection table (many-to-many table) as
(MANDANT, PK A, PK C). You also define one foreign key (MANDANT, PK A) to table A and another foreign key (MANDANT, PK C) to table C. If you set it up like this, the foreign keys make sure that the mandant has to exist in table A and C.

Bye,
Alex Received on Wed Dec 31 1997 - 00:00:00 CST

Original text of this message

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