Re: NULL values or Zero in numeric fields?
From: Steve Edelstein <74160.645_at_CompuServe.COM>
Date: 1995/12/13
Message-ID: <4amscm$ko4$5_at_mhafm.production.compuserve.com>#1/1
Date: 1995/12/13
Message-ID: <4amscm$ko4$5_at_mhafm.production.compuserve.com>#1/1
The correct way to model numbers is to use NULL if the value is
absent or 0 if the number is really zero. Then you use the NVL
function to compute across columns, as in:
select NVL(col1,0) + NVL(col2,0)...
That tells SQL to add numbers it finds in col1 and col2; if it
encounters a null value, substitute a 0 for the arithmetic only
(the column value remains null). If you try to sum null and
numeric values without NVL, the result is ALWAYS a null, which is
of course inaccurate.
-- Steve Edelstein VOICE: 212-956-3670 Relational Business Systems CompuServe: 74160,645 124 West 60th Street Suite 47C Author of New York, NY 10023 "Learning Oracle Forms"Received on Wed Dec 13 1995 - 00:00:00 CET