SQL> create table exceptions(row_id rowid,
2 owner varchar2(30),
3 table_name varchar2(30),
4 constraint varchar2(30));
Table created
SQL> create table t1(c1 number);
Table created.
Elapsed: 00:00:03.06
SQL> alter table t1 add constraint cts_t1 unique(c1);
Table altered.
Elapsed: 00:00:00.04
SQL> set timing off;
SQL> insert into t1 values(1);
1 row created.
SQL> insert into t1 values(2);
1 row created.
SQL> commit;
Commit complete.
SQL> alter table t1 disable constraint cts_t1;
Table altered.
SQL> insert into t1 values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> alter table t1 enable constraint cts_t1 exceptions into exceptions;
alter table t1 enable constraint cts_t1 exceptions into exceptions
*
ERROR at line 1:
ORA-02299: cannot validate (TEST.CTS_T1) - duplicate keys found
SQL> select * from t1;
C1
----------
1
2
1
SQL> select * from exceptions;
ROW_ID OWNER TABLE_NAME CONSTRAINT
------------------ ------------------------------ ------------------------------ -------------------
AAAHgPAAKAAAAAiAAA TEST T1 CTS_T1
AAAHgPAAKAAAAAiAAC TEST T1 CTS_T1
SQL> select rowid,c1 from t1;
ROWID C1
------------------ ----------
AAAHgPAAKAAAAAiAAA 1
AAAHgPAAKAAAAAiAAB 2
AAAHgPAAKAAAAAiAAC 1
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/45259/viewspace-134934/ ,如需转载,请注明出处,否则将追究法律责任。