Adding a UNIQUE Constraint : Unique « Table « Oracle PL/SQL Tutorial






SQL> -- create demo table
SQL> create table myTable(
  2    id           NUMBER(2),
  3    value        NUMBER(6,2)
  4  )
  5  /

Table created.


SQL>
SQL> ALTER TABLE myTable
  2  ADD CONSTRAINT uq UNIQUE (id);

Table altered.

SQL>
SQL>
SQL> drop table myTable
  2  /

Table dropped.
SQL>








6.12.Unique
6.12.1.Adding a UNIQUE Constraint
6.12.2.Add unique constraint across more than one columns
6.12.3.Add unique constraints for combined columns
6.12.4.Add unique constaint to new added column
6.12.5.Violate an unique constraints
6.12.6.Add unique constraints
6.12.7.ORA-00001: unique constraint (JAVA2S.JOB_UNIQUE_IN_TEAMID) violated