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: Turkbear <john.g_at_dot.spamfree.com>
Date: Thu, 21 Oct 2004 09:03:24 -0500
Message-ID: <1098367333.gXUQVASFWJ2w6+Z1F1snYQ@teranews>


"Mark C. Stock" <mcstockX_at_Xenquery .com> wrote:

>
>"Agoston Bejo" <gusz1_at_freemail.hu> wrote in message
>news:cl8ba7$d04$1_at_news.caesar.elte.hu...
>| I want to enforce such a constraint on a column that would ensure that the
>| values be all unique, but this wouldn't apply to NULL values. (I.e. there
>| may be more than one NULL value in the column.)
>| How can I achieve this?
>| I suppose I would get the most-hated "table/view is changing,
>| trigger/function may not see it" error if I tried to write a trigger that
>| checks the uniqueness of non-null values upon insert/update.
>|
>|
>
>did you try a standard UNIQUE constraint on the column?
>
>unlike SQL-Server (unless they've changed it since I last worked on it),
>Oracle processes null values properly in this scenario (i.e., one NULL value
>is never consider equal to another NULL value)
>
>++ mcs
>

Yep..A Unique index can enforce a Unique Constraint and can handle NULLs ..A Primary key, on the other hand, cannot have NULLs.. Received on Thu Oct 21 2004 - 09:03:24 CDT

Original text of this message

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