oracle主键重复报错,oracle 主键唯一索引,约束一直生效的,索引状态为有效。但有重复值。什么原因呢?...

SYS@orcl1>create table test_index as select * from dba_tables where rowNum<30;

Table created.

SYS@orcl1>insert into test_index select * from dba_tables where rowNum<28;

27 rows created.

SYS@orcl1>commit;

Commit complete.

SYS@orcl1> select TABLE_NAME ,count() from test_index group by TABLE_NAME having count(1) > 1 fetch first 10 rows only;

select TABLE_NAME ,count() from test_index group by TABLE_NAME having count(1) > 1 fetch first 10 rows only

*

ERROR at line 1:

ORA-00933: SQL command not properly ended

SYS@orcl1>select TABLE_NAME ,count(*) from test_index group by TABLE_NAME having count(1) > 1 ;

TABLE_NAME COUNT(*)

ICOL$ 2

TS$ 2

UNDO$ 2

FET$ 2

OBJ$ 2

USER$ 2

UET$ 2

SEG$ 2

CLU$ 2

IND$ 2

COL$ 2

TABLE_NAME COUNT(*)

PROXY_DATA$ 2

LOB$ 2

FILE$ 2

TSQ$ 2

COLTYPE$ 2

16 rows selected.

SYS@orcl1> alter table test_index add constraints pk_objname1 primary key (TABLE_NAME) novalidate;

alter table test_index add constraints pk_objname1 primary key (TABLE_NAME) novalidate

*

ERROR at line 1:

ORA-02437: cannot validate (SYS.PK_OBJNAME1) - primary key violated

SYS@orcl1>

执行不成功。报错的呀~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值