当前位置:数据库 > Oracle >>

oracle四舍五入取得的数值

oracle四舍五入取得的数值
 
SELECT ROUND( number, [ decimal_places ] ) FROM DUAL 
 
说明: 
 
number : 将要处理的数值 
 
decimal_places : 四舍五入,小数取几位,不填默认为0 
 
Sample : 
 
select round(123.456) from dual;              结果: 123 
 
select round(123.456, 0) from dual;          结果: 123 
 
select round(123.456, 1) from dual;          结果: 123.5 
 
select round(123.456, 2) from dual;          结果:123.46 
 
select round(123.456, 3) from dual;          结果: 123.456 
 
select round(-123.456, 2) from dual;         结果:-123.46
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,