How can I count all decimal place up to the first zero
For example I have a column named x with an entry of numeric datatype value 1.955000000
I want to count the decimal places without the zeros. So here I want the query to make an output of 3 not 9 (with zeros)
Best Answer
The only thing I can think of, is to convert the value to a string, remove all trailing zeros, convert it back to a numeric and then use the
scale()
function:The following example:
returns: