I am new to writing queries. I need a query that tells the number of digits after a decimal place.
Eg:
1001.00 = 0 digits after decimal
1001.01 = 2 digits after decimal
1001.010 = 2 digits after decimal
How can I do this?
ORACLE SOLUTION
This can be achieved by multiple ways one of them is below,
SELECT
length((1001.00) - trunc(1001.00)) - 1 as digits_after_decimal
FROM
dual;
SELECT
length((1001.01) - trunc(1001.01)) - 1 as digits_after_decimal
FROM
dual;
SELECT
length((1001.010) - trunc(1001.010)) - 1 as digits_after_decimal
FROM
dual;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With