
round--四舍五入函数
trunc--截断函数
mod--求余函数
round和trunc除了可以操作数字外还可以操作日期。
Demo
SQL> select round(45.926,2),round(45.926,1),round(45.926,0),round(45.926),round(45.926,-1),round(45.926,-2)
2 from dual
3 ; ROUND(45.926,2) ROUND(45.926,1) ROUND(45.926,0) ROUND(45.926) ROUND(45.926,-1) ROUND(45.926,-2)
--------------- --------------- --------------- ------------- ---------------- ----------------
45.93 45.9 46 46 50 0 SQL> select trunc(45.926,2),trunc(45.926,1),trunc(45.926,0),trunc(45.926),trunc(45.926,-1),trunc(45.926,-2)
2 from dual; TRUNC(45.926,2) TRUNC(45.926,1) TRUNC(45.926,0) TRUNC(45.926) TRUNC(45.926,-1) TRUNC(45.926,-2)
--------------- --------------- --------------- ------------- ---------------- ----------------
45.92 45.9 45 45 40 0 SQL> select mod(15,4) from dual; MOD(15,4)
----------
3