Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

nvl function not returning when group by used

635179Apr 29 2008 — edited Apr 29 2008
Hi

I'm a bit confused as to why this will return 0 if sales are null
---------------------------------------------------------------------
SELECT NVL(SUM(SALES)), 0) , COUNT(sale_id) FROM table 1 where date=5201.
---------------------------------------------------------------------

but when i use a group by, the nvl function doesn't work i.e. returns nothing
-------------------------------------------------------------------------
SELECT NVL(SUM(SALES)), 0) , COUNT(sale_id) FROM table 1 where date=5201 group by supplier
-----------------------------------------------------------------------

Your help is appreciated.
David
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 27 2008
Added on Apr 29 2008
14 comments
4,300 views