Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Unique Constraint vs Unique Index
One difference is that foreign keys must reference unique or primary key
constraints. Unique indexes are not enough. For that reason, a constraint
is important for the primary key at least.
Also, I believe if you look at the ALTER TABLE syntax, you can specify the name of the index that will ensure the uniqueness for the unique constraint.
Regards,
Matt
>
>I myself have never truly understood the difference. I do know that if you
>declare a unique constraint, Oracle creates an index for you. This index is
>used to ensure the uniqueness of the attribute values. If you create an
>index on a column and declare it to be unique, it does the same thing. I
>guess it's just two different ways of accomplishing the same thing. If you
>need to drop the index (and recreate it) then I would use the unique index
>option. That way I know the name of the index. (although it's not too hard
>to find the index created for a unique constraint).
>
>Hope that helps,
>Brian Peasland
>peasland_at_msn.com
>
>
Received on Tue Jun 08 1999 - 18:33:48 CDT
![]() |
![]() |