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

Home -> Community -> Usenet -> c.d.o.misc -> Re: unique constraint error

Re: unique constraint error

From: Bill Thorsteinson <billthor_at_yahoo.com>
Date: Mon, 22 Jul 2002 08:21:40 -0400
Message-ID: <2ktnju0fn1mr5muvkp8d6r22b3p5sb0ntk@4ax.com>


On Mon, 22 Jul 2002 09:58:32 +0200, "Cel" <cefernan_at_capgemini.fr> wrote:

>so what exactly is a unique index ?
>what's it used for ?
>

A Unique Index is and index that allows one record for each index value. Multiple records with all values null. The index can contain null values for some fields.

It is used when you have data in a table you don't want to duplicate.

For example, assume you have a list of people your system knew about. If you add a user-id to the record you would want a unique index on the user-id so you don't end up with multiple users with the same id.

You can also use it if the natural primary key is compound and has nullable components. Create a unique index on the natural key, and a generated value as the primary key. If there are no nullable fields, you may do the same to provide a simpler id for foreign key references.

>"TurkBear" <jgreco1_at_mn.rr.com> a écrit dans le message news:
>8qigju41jlklidlreeh9f480tvgmfhfk2e_at_4ax.com...
>>
>> Your procedure should check for the record and then do either an update or
>an Insert..
>>
Received on Mon Jul 22 2002 - 07:21:40 CDT

Original text of this message

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