C:\Users\XXX>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on 星期日 8月 28 15:51:42 2016

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

sys@XXX> select to_char('0.123','FM999999999990.00'),0.123 from dual;

TO_CHAR('0.123',      0.123
---------------- ----------
0.12                   .123

sys@XXX> select to_char('0.125','FM999999999990.00'),0.125 from dual;

TO_CHAR('0.125',      0.125
---------------- ----------
0.13                   .125

它的执行结果如下:

  ①其9代表:如果存在数字则显示数字,不存在则显示空格;

  ②其0代表:如果存在数字则显示数字,不存在则显示0,即占位符;

  ③其FM代表:删除如果是因9带来的空格,则删除之;

  ④四舍五入:0.125变成了0.13不知道大家注意到了没有。如果不要四舍五入,则需要trunc下;

相关文章:

  • 2021-08-02
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2021-12-11
  • 2021-12-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-16
  • 2021-06-08
  • 2022-12-23
相关资源
相似解决方案