Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Foreign key to multiple tables ???
Hi,
Suppose I want to create three tables: one "child" table and two master tables:
create table customer_account (customer_id number(9),
account_class varchar2(10), account_type number(2), ...) create table savings_account_types(account_type number(2),
...)
create table check_account_types (account_type number(2),
...)
In the child table customer_account field account_class implies whether account_type refers to savings_account_types (account_class='savings') or check_account_types (account_class='check').
Is there an elegant way to create declarative data integrity constraints to make sure that every account has a valid account_class/account_type combination?
This functionality could be achieved using database triggers, but I suppose triggers won't fire during database import.
How about performance issues ?
Thanks,
Kirmo.Uusitalo_at_comptel.fi Comptel Oy System Analyst Ruoholahdenkatu 4 tel. +358-9-70011662 00180 HELSINKI fax 70011385 FINLANDReceived on Tue Nov 19 1996 - 00:00:00 CST