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: Difference between Unique Constraint & Unique Index

Re: Difference between Unique Constraint & Unique Index

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 02 Sep 1998 15:50:58 GMT
Message-ID: <35f8675e.10192686@192.86.155.100>


A copy of this was sent to "Gilles FLORENTIN" <gflorentin_at_hol.fr> (if that email address didn't require changing) On Wed, 2 Sep 1998 10:28:45 +0200, you wrote:

>Hi,
>
>What's the difference between unique constraints and unique indexes.
>
>Thank's
>

a unique constraint will *typically* create a unique index to help it enforce the uniqueness. A unique index is just an index -- its not a constraint.

You can create a foreign key to a set of columns that have a UNIQUE CONSTRAINT on them -- you cannot create a foreign key to a set of columns that simply have a unique index on them.

unique constraints don't always create unique indexes -- if one already exists on that set of column, the unique constraint might 'takeover' that index or if the constraint is defferable -- it won't use a unique index but will use a 'regular' index instead.  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Sep 02 1998 - 10:50:58 CDT

Original text of this message

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