Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Foreign key to multiple tables ???

Foreign key to multiple tables ???

From: Kirmo Uusitalo <kirmo.uusitalo_at_comptel.fi>
Date: 1996/11/19
Message-ID: <56ruho$rqn@pinta.kolumbus.fi>#1/1

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                    FINLAND
Received on Tue Nov 19 1996 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US