Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unique index vs Unique constraint

vpolasaJan 14 2015 — edited Jan 15 2015

Apologies for asking a very basic question (which also has been discussed many times in the past).

We have a table with 100 records and would like to enforce a unique constraint on a field (not referenced in any table). My colleague suggests to create a unique index instead of the constraint. As we are not looking for any performance here, what difference would it make by creating a unique index over a unique constraint?

My colleague may not be wrong as the unique index too refrains from adding any duplicate data to the field, but this is not what business wants. How can I prove my colleague that suggested approach would be going with constraint? If I go with unique index, will there be any impact down the line?

If both our approaches are right, what is the difference between unique constraint and unique index in this scenario?

Creating a unique constraint creates unique index.

We cannot drop the index alone and if we drop the constraint, the index will be dropped too.

Creating a unique index does not create a unique constraint.

Working on Oracle 12c, Win7

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2015
Added on Jan 14 2015
5 comments
3,953 views