函数:ROUND( number, [ decimal_places ] )
——number : 要处理的数值;
——decimal_places :四舍五入后,小数点后保留几位,可不写,默认为0;
举例:
2015年11月4日 星期三
-- 小数点后保留0位时:
SQL> select round(99.546) from dual;
ROUND(99.546)
-------------
100
-- 小数点后保留1位时:
SQL> select round(99.546,1) from dual;
ROUND(99.546,1)
---------------
99.5
-- 小数点后保留2位时:
SQL> select round(99.546,2) from dual;
ROUND(99.546,2)
---------------
99.55
-- 负数小数点后保留0位时:
SQL> select round(-99.546) from dual;
ROUND(-99.546)
--------------
-100
-- 负数小数点后保留1位时:
SQL> select round(-99.546,1) from dual;
ROUND(-99.546,1)
----------------
-99.5
2015年11月4日 星期三