Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Difference: Uniq. Constraint & Index ?
klabu wrote:
> alter table my_emp
> add constraint u_con unique (col_a) ;
>
> create unique index u_index on my_emp (col_a);
>
> What is the difference between Unique Constraint and Unique Index ?
> And under what circumstance(s) will their difference come into play ?
>
> thanks
In terms of the affect on the data there is essentially no difference.
However I would argue that you should never build a unique index.
Here are just a few of the differences:
1. Unique constraints put an entry into user_indexes 2. Unique indexes do not create an entry in user_constraints 3. You can not defer an index 4. You can not disable an index (except FBI) 5. Unique indexes have no equivalent to NORELY 6. Unique indexes have no equivalent to NOVALIDATE
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Mon Oct 16 2006 - 20:20:55 CDT
![]() |
![]() |