如何在oracle中显示如下值:
99.99 为 99.9900, 99.9 为 99.9000, 9.99 为 9.9900, 99 为 99.0000
所有情况都应该满足..请帮助...
使用格式字符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
您将在文档中找到所有格式选项。
Use the TO_CHAR function, with a format argument:
select to_char(99.99, '99.9999') from dual;