OracleBrains.Com header image 2

Creating Primary Key On Duplicate Values

November 13th, 2007 by Rajender Singh · No Comments

Check out following:

SQL> select * from test;

COL1
———-
1
1
1
1
1

SQL> alter table test add constraint test_idx primary key(col1) disable;

Table altered.

SQL> create index test_idx on test(col1);

Index created.

SQL> alter table test enable novalidate constraint test_idx;

Table altered.

SQL> insert into test values(1);
insert into test values(1)
*
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.TEST_IDX) violated


Tags: Oracle Administration · Oracle Database · SQL and PL/SQL

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment