trunc是截断;round是四舍五入;下面通过一个例子具体看一下trunc和round的不同
SQL> select trunc(45.923,2),trunc(45.923),trunc(45.923,-1) 2 from dual; TRUNC(45.923,2) TRUNC(45.923) TRUNC(45.923,-1) --------------- ------------- ---------------- 45.92 45 40 SQL> select round(45.923,2),round(45.923),round(45.923,-1) 2 from dual; ROUND(45.923,2) ROUND(45.923) ROUND(45.923,-1) --------------- ------------- ---------------- 45.92 46 50
时间: 2024-10-11 00:51:46