If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Number format conversion

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-21-09, 10:03
veparala12 veparala12 is offline
Registered User
 
Join Date: Jul 2009
Posts: 1
Number format conversion

Hi

I need to convert number from format 0 to 0.00. Can you let me know what is the function and example?.

Thanks
Reply With Quote
  #2 (permalink)  
Old 07-21-09, 10:10
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Can you explain the semantics that you want to have? Do you just want to show 2 trailing digits? If so, convert the number to a string and concatenate it with '.00'. Or maybe you want to convert your number to a DECIMAL value with a scale of 2? Or maybe you just want to do this: CASE WHEN number = 0 THEN '0.00' END.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 07-21-09, 22:01
DB2Plus DB2Plus is offline
Registered User
 
Join Date: Jul 2009
Posts: 150
You can use the function DECIMAL(x, p, 2) where p - number of digits in x.
p > 2

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On