日期:2014-05-16 浏览次数:20504 次
保留2位小数 , 不够补0 :
select to_char(123456789.9,'999999999.00') from dual
结果:
?123456789.90
?
select to_char(123456789.1234,rpad('999999999.',11,'0'))? from dual
结果:
?123456789.12
?
select round(1234.45,1) from dual
结果:
1234.5
(round会四舍五入)
?
select round(1234.45,3) from dual
结果:
1234.45
?
select trunc(1234.45678,3) from dual
结果:
1234.456
(trunc直接截断,不会四舍无入)