今早在看论坛时突然想起这两个函数,所以就记录下来,以后好参考一下
首先看一下例子:
Windows XP
orcle 9.2.0.1.0
Connected to Oracle9i Enterprise Edition Release 9.2.0.1.0
Connected as SCOTT
SQL> select ROUND(12375.989,-2) FROM DUAL;
ROUND(12375.989,-2)
-------------------
12400
SQL> select ROUND(12335.989,-2) FROM DUAL;
ROUND(12335.989,-2)
-------------------
12300
SQL> select TRUNC(123875.989,-2) FROM DUAL;
TRUNC(123875.989,-2)
--------------------
123800
1. 这两个函数都都有两个参数,如果没有写后面的数字那么默认是0.
2.round(xx,number)是要四舍五入的.
3.trunc(xx,number)是不具有四舍五入的功能