Foreign key constraints with constant values?

From: Octavian Rasnita <orasnita_at_gmail.com>
Date: Sat, 23 Oct 2010 21:14:00 +0300
Message-ID: <68ACB7E80F044140A9A35471A1E0E62E_at_teddy>



Hi,

I have made the following table:

create table client(
id integer not null,
name varchar2(200),
type1 integer not null,
type2 integer not null,
foreign key (type1, type2) references constants(id, type)
);

It works fine, but the column type2 contains a unique value in all the records. Is it possible to drop that column and use the constant value from it in the foreign key reference directly?

I have tried the following, but it gave an error:

create table client(
id integer not null,
name varchar2(200),
type1 integer not null,
foreign key (type1, 1) references constants(id, type)
);

Thanks.

Octavian

--
http://www.freelists.org/webpage/oracle-l
Received on Sat Oct 23 2010 - 13:14:00 CDT

Original text of this message