0

如何在oracle中显示如下值:

99.99 为 99.9900, 99.9 为 99.9000, 9.99 为 9.9900, 99 为 99.0000

所有情况都应该满足..请帮助...

4

2 回答 2

2

使用格式字符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

您将在文档中找到所有格式选项。

于 2010-09-13T08:49:21.623 回答
0

Use the TO_CHAR function, with a format argument:

select to_char(99.99, '99.9999') from dual;
于 2010-09-13T08:14:10.437 回答