dbTalk Databases Forums  

oracle sum display zero instead of NULL

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss oracle sum display zero instead of NULL in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
trpost@gmail.com
 
Posts: n/a

Default oracle sum display zero instead of NULL - 11-01-2007 , 04:42 PM






I have a simple query:

SELECT SUM(cases_escalated) AS casesescalated FROM groupsummary WHERE
report_date=TO_DATE('Sep 2007','MON YYYY') AND group_name = 'T1';

The query works fine, except for when there is nothing to SUM and then
I get returned NULL instead of 0.

My question is how can I get the query to display 0 instead of
'blank'; I read something about using a join, but I don't see how
joining would help me as right now this is the only table in my
database. Would I somehow join against a query to DUAL?


Reply With Quote
  #2  
Old   
DA Morgan
 
Posts: n/a

Default Re: oracle sum display zero instead of NULL - 11-01-2007 , 05:21 PM






trpost (AT) gmail (DOT) com wrote:
Quote:
I have a simple query:

SELECT SUM(cases_escalated) AS casesescalated FROM groupsummary WHERE
report_date=TO_DATE('Sep 2007','MON YYYY') AND group_name = 'T1';

The query works fine, except for when there is nothing to SUM and then
I get returned NULL instead of 0.

My question is how can I get the query to display 0 instead of
'blank'; I read something about using a join, but I don't see how
joining would help me as right now this is the only table in my
database. Would I somehow join against a query to DUAL?

NVL(caes_escalated, 0)
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.