Re: NULL values in Unique constrain

From: Phil Singer <psinger1_at_chartermi.net>
Date: Wed, 03 Oct 2001 22:08:52 -0400
Message-ID: <3BBBC4B4.C36357A3_at_chartermi.net>


Diego Dal Cero wrote:
>
> Hi everybody,
>
> I'm having some problem defining a table, having in mind first of all
> database indipendence.
>
> My table is in his fundamentals somethink like that:
>
> create table mytable (
> value1 integer not null,
> value2 integer null
> value3 integer not null,
> unique (value1, value2, value3)
> )
>
> Is this correct or the "value2" column should be also "not null"? In
> my application, in certain cases, the "value2" could be null.
>
> Thank you very much for your help.
>
> Diego Dal Cero.

If value1 or value3 are going to be your primary key, then you will have no problems (aside from the generic ones involving NULLs which I'll leave for a wiser one than me to comment on).

If you are trying to create a table with a composite primary key, which consists of the entire table, then you will have many problems. Rethink your design and/or post more details.

-- 
Phil Singer                |    psinger1_at_chartermi.net
Oracle DBA
Received on Thu Oct 04 2001 - 04:08:52 CEST

Original text of this message