SQL> create table t( x int,y int);
Table created.
SQL> insert into t values(1,1);
1 row created.
SQL> insert into t values(1,2);
1 row created.
SQL> create unique index u_t on t(x,y);
Index created.
SQL> commit;
Commit complete.
SQL> insert into t values(1,3);
1 row created.
SQL> insert into t values(1,3);
insert into t values(1,3)
*
ERROR at line 1:
ORA-00001: unique constraint (THE9.U_T) violated
SQL> update t set y=2 where x=1;
update t set y=2 where x=1
*
ERROR at line 1:
ORA-00001: unique constraint (THE9.U_T) violated
SQL> update t set y=2 where x=1 and y=2;
1 row updated.
SQL> rollback;
Rollback complete.
SQL> select * from t;
X Y
---------- ----------
1 1
1 2
SQL> update t set x=1 where y=2;
1 row updated.
SQL>