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 -> optional foreign key

optional foreign key

From: Roy Smith <roy_at_popmail.med.nyu.edu>
Date: Tue, 24 Aug 1999 11:03:54 -0400
Message-ID: <roy-2408991103540001@qwerky.med.nyu.edu>


I've got a table something like this:

create table foo
(

   id number primary key;
);

create table bar
(

   id number primary key,
   link references foo
);

The problem is, there will be exceptional cases where I want to put a value in bar.link which doesn't exist in foo.id. What I'd like is something like this:

create table bar
(

   id number primary key,
   special char(1),
   link constraint check (special = 'X' or references foo) );

Obviously, that's made-up syntax, but that's the idea I want. Any way to do something like this?

The alternative would be to just add dummy "place-holder" entries in foo to handle these exceptional cases, but I'd rather not do that if I can avoid it.

--
Roy Smith <roy_at_popmail.med.nyu.edu>
New York University School of Medicine Received on Tue Aug 24 1999 - 10:03:54 CDT

Original text of this message

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