SQL> create table registrations
2 ( attendee NUMBER(4)
3 , course VARCHAR2(6)
4 , begindate DATE
5 , evaluation NUMBER(1)
6 , constraint R_PK primary key(attendee,course,begindate)
7 ) ;
Table created.
SQL>
SQL> insert into registrations values (8,'JAV',date '2009-12-13',5 );
1 row created.
SQL> insert into registrations values (9,'JAV',date '2009-12-13',4 );
1 row created.
SQL> insert into registrations values (4,'JAV',date '2000-02-01',3 );
1 row created.
SQL> insert into registrations values (8,'JAV',date '2000-02-01',4 );
1 row created.
SQL> insert into registrations values (6,'JAV',date '2000-02-01',5 );
1 row created.
SQL> insert into registrations values (12,'XML',date '2000-02-03',4 );
1 row created.
SQL> insert into registrations values (2,'XML',date '2000-02-03',5 );
1 row created.
SQL> insert into registrations values (4,'PLS',date '2000-09-11',NULL);
1 row created.
SQL> insert into registrations values (2,'PLS',date '2000-09-11',NULL);
1 row created.
SQL> insert into registrations values (11,'PLS',date '2000-09-11',NULL);
1 row created.
SQL>
SQL> create unique index oau_reg on registrations
2 ( case course when 'OAU' then attendee else null end
3 , case course when 'OAU' then course else null end );
Index created.
SQL>
SQL> insert into registrations values (12,'OAU',sysdate,null);
1 row created.
SQL>
SQL> drop index oau_reg;
Index dropped.
SQL> drop table registrations;
Table dropped.