暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

I am using to_char(num_col,'9999') to get a 4-character output, but is keeps coming out one column too wide. What's wrong ?

2011-01-01
763

The Oracle (tm) Users' Co-Operative FAQ

I am using to_char(num_col,'9999') - how do I get rid of the leading blank ?


Author's name: Connor McDonald

Author's Email: connor_mcdonald@yahoo.com

Date written: August 22, 2001

Oracle version(s): 7.3+

I am using to_char(num_col,'9999') to get a 4-character output, but is keeps coming out one column too wide. What's wrong ?


By default, Oracle reserves a space for a sign digit when converting a number to a character

SQL> select to_char(1234,'9999') x from dual;
X
-----
 1234
^- note leading space

To remove this, all you need do is specify the additional FM mask ("fill mode")

SQL> select to_char(1234,'fm9999') x from dual;
X
-----
1234

Further reading: N/A



最后修改时间:2020-04-16 15:13:12
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论