Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Add a 2-column UNIQUE constraint on an existing table in Oracle 7.3.4?
Whoops, I was mixing my alter...add and alter...modify. All I needed was:
alter table existing_table add (
constraint existing_table_uk unique(id,code));
On Fri, 02 Jun 2000 20:15:15 GMT, hoke_at_gse.harvard.edu (Ken Ho) wrote:
>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
![]() |
![]() |