Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Unique Constraint vs Unique Index

Re: Unique Constraint vs Unique Index

From: Matthew McPeak <mcpeakm_at_email.msn.com>
Date: Tue, 8 Jun 1999 19:33:48 -0400
Message-ID: <ep5X6fgs#GA.115@cpmsnbbsa02>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US