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>
SQL> INSERT INTO person VALUES ('CA', 'Chase', 'At', '01-FEB-02');
1 row created.
SQL> INSERT INTO person VALUES ('GA', 'Chase', 'At', '01-FEB-02');
INSERT INTO person VALUES ('GA', 'Chase', 'At', '01-FEB-02')
*
ERROR at line 1:
ORA-00001: unique constraint (JAVA2S.PERSON_UNIQUE) violated
SQL> INSERT INTO person VALUES ('BB', 'Bob', 'Bark', '28-FEB-02');
1 row created.
SQL> INSERT INTO person VALUES ('LB', 'Laren', 'Baby', '01-MAR-02');
1 row created.
SQL> INSERT INTO person VALUES ('LN', 'Linda', 'Norman', '01-JUN-03');
1 row created.
SQL>
SQL> select * from person;
PER FIRST_NAME LAST_NAME HIRE_DATE
--- --------------- -------------------- ---------
CA Chase At 01-FEB-02
BB Bob Bark 28-FEB-02
LB Laren Baby 01-MAR-02
LN Linda Norman 01-JUN-03
SQL>
SQL> drop table person;
Table dropped.
SQL>
SQL>