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 constraint and NULL values

Re: Unique constraint and NULL values

From: Tony Andrews <andrewst_at_onetel.com>
Date: 21 Oct 2004 06:51:55 -0700
Message-ID: <1098366715.687088.100280@c13g2000cwb.googlegroups.com>


Yes, using a function-based unique index:

SQL> create unique index t1_uk on t1 ( case when b is not null then a end, b );

Index created.

SQL> insert into t1 values(1, null);

1 row created.

SQL> / 1 row created.

SQL> insert into t1 values(1, 1);

1 row created.

SQL> /
insert into t1 values(1, 1)
*
ERROR at line 1:
ORA-00001: unique constraint (TANDREWS.T1_UK) violated Received on Thu Oct 21 2004 - 08:51:55 CDT

Original text of this message

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