Hi,
I was trying to insert duplicate rows in the "tbl_test" table. Initially i had two distinct rows in this table. I then created an Unique index and the Primary key constraint. Now am trying to insert duplicate rows in this table and i got an error stats that Unique constraint violated. I then disabled the Primary key constraint and enabled the NOVALIDATE constraint. Again i was trying to insert the duplicate row but still i got the same error. I know this error throws because of Unique index. I do not want to remove that Unique index. So is there any other possible ways to insert the duplicate rows. This is my query.
CREATE TABLE tbl_test ( col_1 NUMBER, Col_2 varchar(10));
--Table created.
INSERT INTO tbl_test VALUES (1,'XXX');
--1 row(s) inserted.
INSERT INTO tbl_test VALUES (2,'YYY');
--1 row(s) inserted.
CREATE UNIQUE INDEX idx_col_1 ON tbl_test(col_1);
--Index created.
ALTER TABLE tbl_test add constraint idx_col_1 PRIMARY KEY (col_1)
--Table altered.
INSERT INTO tbl_test VALUES (1,'XXX');
--ORA-00001: unique constraint (HR.IDX_COL_1) violated
ALTER TABLE tbl_test DISABLE PRIMARY KEY
--Table altered.
ALTER TABLE tbl_test ENABLE NOVALIDATE PRIMARY KEY
--Table altered.
INSERT INTO tbl_test VALUES (1,'XXX');
--ORA-00001: unique constraint (HR.IDX_COL_1) violated