Add unique constraints for combined columns : Unique « Table « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> CREATE TABLE person (
  2       person_code VARCHAR2(3) PRIMARY KEY,
  3       first_name  VARCHAR2(15),
  4       last_name   VARCHAR2(20),
  5       hire_date   DATE
  6       );

Table created.

SQL>
SQL> ALTER TABLE person
  2  ADD CONSTRAINT person_unique UNIQUE (
  3       first_name,
  4       last_name,
  5       hire_date
  6       );

Table altered.

SQL>
SQL>
SQL> drop table person;

Table dropped.

SQL>
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