round:对某个值进行四舍五入
格式:round(number,decimals)
参数:
number:要进行四舍五入的数值
decimals:指明需保留小数点后面的位数。可选项,忽略它则截去所有的小数部分,并四舍五入。如果为正数则表示从小数点右边开始的位置进行四舍五入,如果为负数则表示从小数点开始左边的位数,相应整数数字用0填充,小数被去掉。
SQL> select sysdate - to_date('01-january-2019') from dual;
SYSDATE-TO_DATE('01-JANUARY-2019')
----------------------------------
1249.50145
SQL> select round(1235.466) from dual;
ROUND(1235.466)
---------------
1235
SQL> select round(1235.466,2) from dual;
ROUND(1235.466,2)
-----------------
1235.47
SQL> select round(1235.466,-1) from dual;
ROUND(1235.466,-1)
------------------
1240
SQL> select round(1234.466,-1) from dual;
ROUND(1234.466,-1)
------------------
1230
版权声明:本文为博主原创文章,未经博主允许不得转载。
oracle