| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Unique Parameter in Index
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
![]() |
![]() |