Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> optional foreign key
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