473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Constraints with several father tables

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
1 3216
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rajesh Kapur | last post by:
We use InnoDB tables and foreign key constraints extensively. The mysqldump backs up the database tables in alphabetical order with foreign key constraints defined in the create statement of each...
0
by: jason_s_ford | last post by:
I have several sql server databases that were recently moved to a new server. In the process of migrating the databases, any triggers and constraints attached to tables were removed on accident. ...
2
by: Davy | last post by:
My program deal with a several level tree with several branchs. The amount of branchs from father node is not known. So I want to creat a tree with dynamic branchs. Now I use the structure:...
10
by: serge | last post by:
I am doing a little research on Google about this topic and I ran into this thread: ...
0
by: BobTheDatabaseBoy | last post by:
i've Googled some this morning, but to my surprise, i don't find any offering (for fee or open source), which would integrate with, say Jakarta Struts, to provide the UI edits from cataloged...
0
by: Frnak McKenney | last post by:
One part of a customer project I'm working on involves what seem like fairly straightforward updates to a set of related tables. While I've developed software for a number of years (it only seems...
3
by: David Parker | last post by:
I would like to be able to truncate all of the tables in a schema without worrying about FK constraints. I tried issuing a "SET CONSTRAINTS ALL DEFERRED" before truncating, but I still get constraint...
4
by: G .Net | last post by:
Hi I have a DataSet with several DataTables. I have set up relations between these tables. I want to delete all the tables and re-fill them. However, when I try to do so, even after using...
1
by: Ralf | last post by:
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.