How to display a value as follows in oracle:
99.99 as 99.9900, 99.9 as 99.9000, 9.99 as 9.9900, 99 as 99.0000
All cases should be satisfied.. Please help...
How to display a value as follows in oracle:
99.99 as 99.9900, 99.9 as 99.9000, 9.99 as 9.9900, 99 as 99.0000
All cases should be satisfied.. Please help...
Use the TO_CHAR function, with a format argument:
select to_char(99.99, '99.9999') from dual;
Use the format character 0
:
SQL> SELECT x, to_char(x, '99.0000')
2 FROM (SELECT 99.99 x FROM dual
3 UNION ALL SELECT 99.9 FROM dual
4 UNION ALL SELECT 9.99 FROM dual
5 UNION ALL SELECT 99 FROM dual);
X TO_CHAR(X,'99.0000')
---------- --------------------
99,99 99.9900
99,9 99.9000
9,99 9.9900
99 99.0000
You will find all format options in the documentation.