ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Exception into table

Exception into table

原创 Linux操作系统 作者:dragondb 时间:2019-05-17 21:03:05 0 删除 编辑
打开constraints时将exception into table......

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/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: using index
请登录后发表评论 登录
全部评论

注册时间:2003-05-05

  • 博文量
    98
  • 访问量
    94093