| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Add a 2-column UNIQUE constraint on an existing table in Oracle 7.3.4?
From SQL Worksheet hitting an Oracle 7.3.4 server I get the following error:
alter table existing_table modify (
ID VARCHAR2(30) not null,
CODE VARCHAR2(30) not null
constraint existing_table_uk unique(id,code));
constraint existing_table_uk unique(id,code))
*
ORA-02253: constraint specification not allowed here
Is there another way to do what I want, namely to add a unique constraint on the combination of the id & code columns in an *existing* table, both of which already are not allowed to be null? Using the similar code for create table does work, but I'd like to avoid recreating the table:
create table new_table (
ID VARCHAR2(30) not null,
CODE VARCHAR2(30) not null,
constraint new_table_uk unique (id,code));
Statement processed.
Received on Fri Jun 02 2000 - 00:00:00 CDT
![]() |
![]() |