在oracle中将987,654,321.09格式字符串转换为987,654,321.09数字格式

时间:2016-11-01 18:21:23

标签: oracle plsql

我尝试将字符串987,654,321.09转换为具有相同格式的数字 我在select语句中使用了一个案例如下:

select 
case when NUMBER_FORMAT is null or NUMBER_FORMAT = 0 
then
to_number ('987,654,321.09', '999,999,999.99')
else
NUMBER_FORMAT end as numberFormat
from agileuser;

此查询返回格式为987654321.09。

有谁知道如何以数字数据类型返回987,654,321.09。

1 个答案:

答案 0 :(得分:0)

谢谢大家,我做了以下工作并且有效:

select 
case when to_char(to_number(NUMBER_FORMAT), '999,999,999.00') is null or to_char(to_number(NUMBER_FORMAT), '999,999,999.00') = 0 
then
to_char(to_number('987654321.09'), '999,999,999.00')
else
to_char(to_number(NUMBER_FORMAT), '999,999,999.00') end as numberFormat
from agileuser