Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Miscellaneous > ForeignKey-Cons...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 11 Topic 6798 of 7279
Post > Topic >>

ForeignKey-Constraint with more than 1 tables

by Andreas Mosmann <mosmann@[EMAIL PROTECTED] > Mar 28, 2008 at 10:04 AM

Hi ng,

(Oracle 9.2.0.7i)

I talk about a database concerning real Trees.
There is a table TTrees.

A single Tree belongs either to a forrest or to a street or to a park or 
whatelse.

So there exist f.e. a table TStreets and a table TForrests.
in the table TTrees actually exist a field for each Table, f.e.

CIDFORREST
CIDSTREET

Exactly 1 of them is not NULL, all the others are definitely NULL.

Now my Questions:
Is there a way to substitute this by only 1 Field, f.e. CID_BELONGS_TO 
_AND_ to build a FK-constraint like

TForrests.CID=TTrees.CID_BELONGS_TO OR
TStreets.CID=TTrees.CID_BELONGS_TO ...
?

Is there a possibility to build a constraint, that observes that _exact_ 
1 of the fields (CIDFORREST, CIDSTREET ..) is not null? (I know, I could 
use triggers for it)?

Is there a better way to build this database? (The Columns of TTrees are 
95% equal, no matter if it stands on a street or in a forrest, so there 
is only 1 table)

Many thanks
Andreas Mosmann




-- 
wenn email, dann AndreasMosmann <bei> web <punkt> de
 




 11 Posts in Topic:
ForeignKey-Constraint with more than 1 tables
Andreas Mosmann <mosma  2008-03-28 10:04:52 
Re: ForeignKey-Constraint with more than 1 tables
Hans Mayr <mayr1972@[E  2008-03-28 02:22:16 
Re: ForeignKey-Constraint with more than 1 tables
Andreas Mosmann <mosma  2008-03-28 10:43:00 
Re: ForeignKey-Constraint with more than 1 tables
Hans Mayr <mayr1972@[E  2008-03-28 04:29:41 
Re: ForeignKey-Constraint with more than 1 tables
Ed Prochak <edprochak@  2008-03-28 07:00:12 
Re: ForeignKey-Constraint with more than 1 tables
"Shakespeare" &  2008-03-29 12:51:27 
Re: ForeignKey-Constraint with more than 1 tables
Frank van Bortel <fran  2008-03-28 20:11:29 
Re: ForeignKey-Constraint with more than 1 tables
"Shakespeare" &  2008-03-29 12:57:13 
Re: ForeignKey-Constraint with more than 1 tables
Frank van Bortel <fran  2008-03-29 13:40:31 
Re: ForeignKey-Constraint with more than 1 tables
vitalisman@[EMAIL PROTECT  2008-03-28 12:17:01 
Re: ForeignKey-Constraint with more than 1 tables
Andreas Mosmann <mosma  2008-04-02 11:10:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 21:08:50 CST 2008.