Avatar of MIHIR KAR
MIHIR KAR
Flag for India asked on

How oracle allowing duplicate values for unique indexes which already defined for a table object ?

I have tables with unique indexes(composite of  columns), though it is unique indexes attached to the table object, still
 having duplicate values for the same unquie index key values.

SQL> create table dummy_objects (object_id  number, object_owner varchar2(30), object_name varchar2(30));

Table created.

SQL> insert into dummy_objects values (0,'MIHIR','TABLE_A');

1 row created.

SQL> insert into dummy_objects values (1,'HAPPY','TABLE_B');

1 row created.

SQL> insert into dummy_objects values (NULL,'BMK','NULL_1');

1 row created.

SQL> insert into dummy_objects values (NULL,'JOHN','NULL_2');

1 row created.

SQL> create unique index dummy_objects_u1 on dummy_objects(object_id);

Index created.

SQL> drop index dummy_objects_u1;

Index dropped.

SQL> create unique index dummy_objects_u2 on dummy_objects(object_id, object_owner);
create unique index dummy_objects_u2 on dummy_objects(object_id, object_owner)
                                        *
ERROR at line 1:
ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
Oracle Database

Avatar of undefined
Last Comment
johnsone

8/22/2022 - Mon
SOLUTION
Nitin Sontakke

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
schwertner

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
johnsone

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23