Re: ForeignKey-Constraint with more than 1 tables
Date: Fri, 28 Mar 2008 04:29:41 -0700 (PDT)
> 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?
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.
Hans Received on Fri Mar 28 2008 - 06:29:41 CDT