Foreign key constraints with constant values?

  • From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Sat, 23 Oct 2010 21:14:00 +0300

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

--
//www.freelists.org/webpage/oracle-l


Other related posts: