Skip to content Skip to sidebar Skip to footer

Oracle 11g - Add New Column And Set As Unique

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);

Solution 1:

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 );

Post a Comment for "Oracle 11g - Add New Column And Set As Unique"