Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003

    Unanswered: How to determine length of decimal value


    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

    Last edited by palchuri; 10-01-07 at 13:05.

  2. #2
    Join Date
    Jan 2007
    Jena, Germany
    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

Posting Permissions

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