ITPub博客

首页 > 应用开发 > IT综合 > to_char上的fm意思

to_char上的fm意思

原创 IT综合 作者:liang573728 时间:2019-07-13 20:30:06 0 删除 编辑

The format_mask parameter begins with "FM". This means that zeros and blanks are suppressed. This can be seen in the examples below.

to_char(sysdate, 'FMMonth DD, YYYY'); would return 'July 9, 2003'
to_char(sysdate, 'FMMON DDth, YYYY'); would return 'JUL 9TH, 2003'
to_char(sysdate, 'FMMon ddth, YYYY'); would return 'Jul 9th, 2003'

The zeros have been suppressed so that the day component shows as "9" as opposed to "09".

[@more@]

/*
FM :除空格
9999999.0099:允许小数点左边最大正数为7位,小数点右边最少2位,最多4位,且在第5位进行四舍五入
*/
Select TO_CHAR(123.0233,'FM9999999.0099') FROM DUAL

SELECT TO_CHAR('100','fm0000') FROM dual

-----
0100

1 row selected.

SELECT TO_CHAR('100','fm9999') FROM dual

-----
100

1 row selected.

SELECT TO_CHAR(SYSDATE,'yyyymmdd') FROM dual;
--------
20090813

1 row selected.

SELECT TO_CHAR(SYSDATE,'fmyyyymmdd') FROM dual;
--------
2009813

1 row selected.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/640706/viewspace-1025243/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 索引组织表IOT
请登录后发表评论 登录
全部评论

注册时间:2005-10-15

  • 博文量
    152
  • 访问量
    113284