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 > How to determine length of decimal value

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-07, 11:15
palchuri palchuri is offline
Registered User
 
Join Date: Jan 2003
Posts: 47
How to determine length of decimal value

Hi,

I need to build a sql to determine no of digits in the decimal value.

For example

If value is 10.2123 then output should be 4
If value 10.212 then 3
If value 10.2 then 1 ..etc

Any idea how?

Thanks in advanace


Shri
__________________
p.srinivasarao

Last edited by palchuri; 10-01-07 at 12:05.
Reply With Quote
  #2 (permalink)  
Old 10-02-07, 09:39
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
You want to have the digits after the decimal point? If yes, then you can have a look at the value of the "scale" of the DECIMAL type. That value will tell you exactly how many significant digits are allowed. You can use a DESCRIBE statement on the results of a query to get that information.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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