Re: Null's vs Empty string

From: Paul Brewer <paulb_at_pbrewer.demon.co.uk>
Date: 1996/11/04
Message-ID: <jItjgOAiTkfyEwtK_at_pbrewer.demon.co.uk>#1/1


In article <327b33fd.697272_at_news.mindspring.com>, Eric Palmer <efp_at_etechinc.com> writes
>On Sat, 2 Nov 1996 05:05:44 GMT, herman_at_iquest.net wrote:
>
>>Dick van Oordt <dvoordt_at_pi.net> wrote:
>>
 

>>
>>You should be aware that any numeric columns which are left NULL are
>>not considered to be zero in Oracle. You should ALWAYS use the NVL
>>function on numeric columns when doing any type of math. Example:
>>
>>select
>> num_col_1 + num_col_2
>>from
>> sometable;
>>
>>will not give the expected answer if either column is NULL. You
>>should always write this as:
>>
>>select
>> NVL(num_col_1,0) + NVL(num_col_2,0)
>>from
>> sometable;
>>
>>to make sure that a zero is added to num_col_1 if num_col_2 is NULL.
>
>I disagree. There are many cases where you want the numeric value to
>be left as NULL. You should only NVL convert to a 0 value if it makes
>sense for the type of data you have.
>
>Consider patient blood chemistry - a column for white cell count.
>A missing value (NULL) is much different than a value of 0.
>
>Nulls are here for a purpose. Ypu sure don't want to calc. an average
>value and include missing values as 0. It would be statistically
>incorrect.
>
>
>
>--------------------------------------------
>SERIS - SouthEast Regional Internet Society
>Enhancing Your Time On-Line
>http://www.seris.org/
>--------------------------------------------
>Eric F. Palmer
>770.825.0535 Voice - 770.825.0796 Fax
>http://www.etechinc.com/ *** Standard Disclaimer ***
>--------------------------------------------
I am not an expert, but I think there might be more to this than meets the eye.
Seems to me that Oracle has always treated an empty string as null. They aren't the same (and I believe future versions of Oracle will distinguish).
I also _think_ that this is a SQL-92 issue. Doubtless the experts will clarify.

-- 
Paul Brewer
Received on Mon Nov 04 1996 - 00:00:00 CET

Original text of this message