Re: ORA 02270 [message #37329] |
Thu, 31 January 2002 02:29 |
James Richardson
Messages: 1 Registered: January 2002
|
Junior Member |
|
|
Yes, its strange behaviour. You need to add a column-level uniqueness constraint on the foreign-key table.
For some reason table level uniqueness constraints don't work.
In other words, the referenced table should be defined like
create table a ( col1 integer primary key,
col2 varchar2(20) unique )
create table b ( col1 integer primary key,
col2 varchar2(20),
foreign key (col2) references a(col2) )
If you miss out the 'unique', and instead do a
create unique index a_idx1 on a(col2) you will get the 2270 error.
I dont understand this, as the two should be identical (except maybe that you can drop the index, and the unique constraint doesn't _seem_ to be removable/addable from/to the column using alter table)
|
|
|