By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,322 Members | 1,182 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,322 IT Pros & Developers. It's quick & easy.

Constraints with several father tables

P: n/a
Hi,

I have 4 tables: "T_father1",...,"T_father4".
In relation to these father-tables I have a child-table: "T_Child"
(with only 1 foreignkey-field: FsID) alread filled with some records.

That means each record of "T_Child" has in its field "FsID" a primary
key of one of the 4 father tables.

If I want to create the 4 foreign-key CONSTRAINTS:
"T_Child.FsID <-> T_FatherX.ID" (X=1..4)
I get an Oracle-error (Ora-02298): "cannot validate".

My question is:
How can I tell Oracle (how do I have to create the Constraint), that
this foreignkey-field "T_Child.FsID" is not the foreign-key to ONE
father-table but to FOUR father tables ?
Or is this "bad database design" to have one foreignkey-field for 4
father tables ?

Thanks in advance for any help, suggestionst or comments !!
Best regards
Ralf Miko
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Mi**@boehrer.de (Ralf) wrote in message news:<fa**************************@posting.google. com>...
Hi,

I have 4 tables: "T_father1",...,"T_father4".
In relation to these father-tables I have a child-table: "T_Child"
(with only 1 foreignkey-field: FsID) alread filled with some records.

That means each record of "T_Child" has in its field "FsID" a primary
key of one of the 4 father tables.

If I want to create the 4 foreign-key CONSTRAINTS:
"T_Child.FsID <-> T_FatherX.ID" (X=1..4)
I get an Oracle-error (Ora-02298): "cannot validate".

My question is:
How can I tell Oracle (how do I have to create the Constraint), that
this foreignkey-field "T_Child.FsID" is not the foreign-key to ONE
father-table but to FOUR father tables ?
Or is this "bad database design" to have one foreignkey-field for 4
father tables ?

Thanks in advance for any help, suggestionst or comments !!
Best regards
Ralf Miko

I wouldn't even call this design. Multiple foreign keys in multiple
tables to 1 PK are definitely possible. One foreign key to multiple
parents of course not.
Your parent table must be falling apart in several subtypes. Hence you
need to differentiate.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.