问题起源 我们在数据库中存储了利率等信息是小于1的查询出结果后直接转换为字符串,这时候就有问题了比如0.5取出来后变成.5 这时候放到前端显得不伦不类。 解决 to_char 修改数字的格式, 常用的集中情况如下 SELECT 1, TO_CHAR(.08,'fm999999999990.00'), '小数格式化' FROM dual UNION ALL SELECT 2,TO_CHAR(0,'fm999999999990.00') , '0' FROM dual UNION ALL SELECT 3, TO_CHAR(1.236,'fm999999999990.00') , '超出位数四舍五入' FROM dual UNION ALL SELECT 4, TO_CHAR(1999,'fm999999999,990.00') ,'金额格式化,取出后不能用于计算了' FROM dual UNION ALL SELECT 5, TO_CHAR(199,'fm90.00'), '数字过大变成####' FROM dual UNION ALL SELECT 6, TO_CHAR(199,'9990.00'), '不加fm查询结果前面有空格' FROM dual
标签:格式化,数字,UNION,CHAR,fm999999999990.00,dual,oracle,SELECT From: https://www.cnblogs.com/ivenlin/p/18081601