关闭

oracle to_char 避免出现".0"

987人阅读 评论(0) 收藏 举报
参考:http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34510


SELECT TO_CHAR(number, 'fmt')
FROM DUAL;

 

Table 1-1:Results of Number Conversions

※Ps:

FM:Returns a value with no leading or trailing blanks.

number 'fmt' Result

-1234567890

9999999999S

'1234567890-'

0

99.99

' .00'

+0.1

99.99

' .10'

-0.2

99.99

' -.20'

0

90.99

' 0.00'

+0.1

90.99

' 0.10'

-0.2

90.99

' -0.20'

0

9999

' 0'

1

9999

' 1'

0

B9999

' '

1

B9999

' 1'

0

B90.99

' '

+123.456

999.999

' 123.456'

-123.456

999.999

'-123.456'

+123.456

FM999.009

'123.456'

+123.456

9.9EEEE

' 1.2E+02'

+1E+123

9.9EEEE

' 1.0E+123'

+123.456

FM9.9EEEE

'1.2E+02'

+123.45

FM999.009

'123.45'

+123.0

FM999.009

'123.00'

+123.45

L999.99

' $123.45'

+123.45

FML999.99

'$123.45'

+1234567890

9999999999S

'1234567890+'

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:40682次
    • 积分:539
    • 等级:
    • 排名:千里之外
    • 原创:9篇
    • 转载:11篇
    • 译文:0篇
    • 评论:3条
    文章分类