Re: ForeignKey-Constraint with more than 1 tables

From: Hans Mayr <mayr1972_at_gmx.de>
Date: Fri, 28 Mar 2008 04:29:41 -0700 (PDT)
Message-ID: <1e839f7e-1850-4e3f-82b3-1e52426db798@s50g2000hsb.googlegroups.com>


>
> Soory, but I can not find the difference. If I understand correct you
> suggest to create a table TTreeLocations with a primary key LocationID
> and an ObjectID that now has to refer different tables, street, park ...
>
> It is no problem to use 1 sequence for all referred tables street, park
> and so on, but how can I write a constraint, that ensures, that my
> ObjectID is to be found in (exactly) one of these tables?
>

Hi Andreas,

you have a foreign key constraint from TTrees on TTreeLocations and a foreign key constraint from each TStreet, TPark etc. on TTreelocations. The tuple LocationType and Object ID is unique in TTreeLocation. That should make it safe.

Best,

Hans Received on Fri Mar 28 2008 - 06:29:41 CDT

Original text of this message