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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: composite Unique constraint and null

Re: composite Unique constraint and null

From: Wolfgang Breitling <breitliw_at_centrexcc.com>
Date: Tue, 18 Oct 2005 13:52:07 -0600
Message-ID: <43555267.4060706@centrexcc.com>


Interestingly enough, even though one "null" does not equal another "null", i.e. any comparison with NULL is always false, a unique index on (col1, col2) throws a unqiue constraint violation when you insert a second (1,null). It appears that for the index (1,null) IS equal to (1,null) - or does the unique index use reverse logic and checks if (1,null) <> (1,null) and, since this is false, concludes that (1,null) must be equal (1,null) and therefore violate the constraint ;-)

Jared Still wrote:

> A unique constraint can be used for this.
>
> Have you tried it?
>
> --
> Jared Still
> Certifiable Oracle DBA and Part Time Perl Evangelist

-- 
Regards

Wolfgang Breitling
Centrex Consulting Corporation
www.centrexcc.com
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Oct 18 2005 - 14:54:39 CDT

Original text of this message

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