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 Parameter in Index

Re: Unique Parameter in Index

From: Kenneth Koenraadt <plovmand_at_hotmail.com>
Date: Sat, 30 Jun 2001 13:03:46 GMT
Message-ID: <3b3dcc8a.1662955@news.mobilixnet.dk>

On Sat, 30 Jun 2001 17:34:49 +0800, "Victor" <lch_1_at_hotmail.com> wrote:

>Why do we need to set Unique in Creating B-Tree indexes?
>What is the difference between Unique and Non-Unique (Default) in an index??
>THX
>
>

As the word Unique suggest, a Unique Index on a set of columns will not allow duplicate values on this set, whereas a Non-unique index does not have this restriction.

e.g. the statements

create table a1(id varchar2(1);
create unique index a1_idx on a1(id);
insert into a1 values ('a');
insert into a1 values ('a');

Will generate an ORA-00001 error (duplicate value on index) on the fourth statement, as the value 'a' is already in the column contained in the unique index.

Regards,
Kenneth Koenraadt
Systems Consultant
Oracle DBA
plovmand@<no-spam>hotmail.com Received on Sat Jun 30 2001 - 08:03:46 CDT

Original text of this message

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