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: diff. between Primary-Key and unique index

Re: diff. between Primary-Key and unique index

From: Bob Bain <bob.bain_at_terra-nova.e-mail.com>
Date: Fri, 21 Jan 2000 10:21:29 -0000
Message-ID: <ErWh4.81$7R.1018@news.colt.net>


Actually, the only real difference between a Primary Key and a Unique Index is that a Unique index will allow NULL values whereas a primary key won't. If you notice when you create the primary key ORACLE automatically creates a unique index using the keys specified in the PRIMARY KEY command.

From 8.1.5 onwards you can base a PRIMARY KEY on a unique index that you have already built, therefore allowing NULL values in a PRIMARY KEY!!

Where is it documented that unique indexes shouldn't be used anymore, or is this just an Urban Legend that's floating around??

Emmanuel HUMBLOT <e_humblot_at_wanadoo.fr> wrote in message news:01bf63fc$2684a980$3601017e_at_EHM.cirra.fr...
> A unique index created directly with a "create unique index" command is an
> old-fashioned way to code integrity constraints.
>
> It exists for compatibility purposes with older versions of Oracle, but it
> shouldn't be use anymore for new databases.
>
> --
> Regards
>
> Emmanuel HUMBLOT e_humblot_at_wanadoo.fr
>
> Andreas Michler <Andreas.Michler_at_adicom.de> a écrit dans l'article
> <388819AE.547713F0_at_adicom.de>...
> > Can anyone tell me the differences between a table with primary key
> > and
> > a table with no primary key, but a unique index on some fields
> > ????????
> >
> >
> >
> > -------------------------------------
> > ADICOM Informatik GmbH
> > Andreas Michler
> > Wiesfleckenstr. 34
> > 72336 Balingen
> > Tel: 07433/9977-57,Fax: -90
> > E-Mail: Andreas.Michler_at_adicom.de
> > http:\\www.adicom.de
> > -------------------------------------
> >
> >
> >
Received on Fri Jan 21 2000 - 04:21:29 CST

Original text of this message

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