4

I am facing a problem on how to set a new column to unique using Oracle 11g.

I try to use this code but it getting error:

ALTER TABLE QAS_ASSIGNED_STATE ADD UNIQUE (cuid);
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Fai Zal Dong
  • 323
  • 6
  • 25

1 Answers1

3

You should define column's type. Like this:

alter table
    QAS_ASSIGNED_STATE 
 add
    cuid number NULL;

and then add constraint:

ALTER TABLE QAS_ASSIGNED_STATE ADD CONSTRAINT constraint_cuid  UNIQUE (cuid );
S. Nadezhnyy
  • 582
  • 2
  • 6