DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: NULL value query

  1. #1
    Join Date
    Aug 2003
    Posts
    100

    NULL value query

    I need this query to return 00000000.00 if the calculation returns a NULL value, but I can't figure out where to put the NVL function:

    SELECT ltrim(to_char((sum(decode(ic.cost_code,'MSG',(ic.amount*sol.ord_line_weight)/29413))),'09999999.99')) MSG,

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    How about this?
    Code:
    LTRIM(TO_CHAR((SUM(DECODE(ic.cost_code,'msg',
       (NVL(ic.amount*sol.ord_line_weight, 0))/29413))),
       '09999999.99')) msg

  3. #3
    Join Date
    Aug 2003
    Posts
    100
    No luck. It still returns blanks.

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    How about ...
    Code:
    LTRIM(TO_CHAR(NVL(SUM(DECODE(ic.cost_code,'msg',ic.amount*sol.ord_line_weight/29413)),0),'09999999.99')) msg
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  5. #5
    Join Date
    Aug 2003
    Posts
    100
    That works. Thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width