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

Home -> Community -> Usenet -> c.d.o.misc -> Re: NULL or 0 for a "FLAG_COLUMN"

Re: NULL or 0 for a "FLAG_COLUMN"

From: Thomas Kellerer <ESPKLFCTEKVY_at_spammotel.com>
Date: Wed, 06 Sep 2006 17:08:00 +0200
Message-ID: <4m86ifF50n7kU1@individual.net>

On 06.09.2006 16:55 Martin T. wrote:
> Hey all.
>

>>From a general ORACLE point of view (lets say 9i2 upwards), what would

> be the preferred way of storing a true/false flag column.
>
> a) col MY_FLAG: NOT NULL, DEFAULT 0, Possible values: 1, 0
> or
> b) col MY_FLAG: Possible values 1, NULL
>
> There is some side effect of having NULL vs. 0 when using indexes,
> right?
> Any other ideas why the one or other might be better (Storage /
> Performance / Indexing)?

NULL means "undefined".
I would _never_ use it to represent an actual "meaningful" value.

So, I would always choose option a) together with a check constraint only allowing for 0,1 as the value.

Regards
Thomas

-- 
It's not a RootKit - it's a Sony
Received on Wed Sep 06 2006 - 10:08:00 CDT

Original text of this message

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