Oracle 中取整数和四舍五入

FLOOR——对给定的数字取整数位
SQL> select floor(2345.67) from dual;

FLOOR(2345.67)
--------------
2345

CEIL-- 返回大于或等于给出数字的最小整数
SQL> select ceil(3.1415927) from dual;

CEIL(3.1415927)
---------------
              4

ROUND——按照指定的精度进行四舍五入
SQL> select round(3.1415926,4) from dual;

ROUND(3.1415926,4)
------------------
            3.1416

TRUNC——按照指定的精度进行截取一个数
SQL> select trunc(3.1415926,4) from dual;

TRUNC(3.1415926,4)
------------------
            3.1415

猜你喜欢

转载自solomon2012.iteye.com/blog/2101684