关于处理小数点位数的几个oracle函数()
取四舍五入的几位小数select round(1.2345, 3) from dual;
结果:1.235
2. 保留两位小数,只舍select trunc(1.2345, 2) from dual;
结果:1.23
select trunc(1.2399, 2) from dual;
结果:1.23
3.取整数
返回大于或等于x的最大整数:
SQL> select ceil(23.33) from dual;
结果: 24
返回等于或小于x的最大整数:
SQL> select floor(23.33) from dual;
结果: 23
返回舍入到小数点右边y位的x值:rcund(x,[y])
SQL> select round(23.33) from dual;
结果: 23
返回截尾到y位小数的x值:trunc(x,[y])
SQL> select trunc(23.33) from dual;
结果: 23