Home » SQL & PL/SQL » SQL & PL/SQL » Re: ORA 02270
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)
Previous Topic: Collecting records from 2 tables - please help
Next Topic: Collecting data from 2 tables - please help
Goto Forum:
  


Current Time: Fri Apr 19 13:11:30 CDT 2024