取整语句:
select trunc(12345.678,2), trunc(12345.678,1), trunc(12345.678,0), trunc(12345.678,-1), trunc(12345.678,-2) from dual
执行效果:
SQL> select 2 trunc(12345.678,2), 3 trunc(12345.678,1), 4 trunc(12345.678,0), 5 trunc(12345.678,-1), 6 trunc(12345.678,-2) 7 from dual; TRUNC(12345.678,2) TRUNC(12345.678,1) TRUNC(12345.678,0) TRUNC(12345.678,-1) ------------------ ------------------ ------------------ ------------------- TRUNC(12345.678,-2) ------------------- 12345.67 12345.6 12345 12340 12300
五舍六入函数:
select round(12345.678,2), round(12345.678,1), round(12345.678,0), round(12345.678,-1), round(12345.678,-2) from dual
执行效果:
SQL> select 2 round(12345.678,2), 3 round(12345.678,1), 4 round(12345.678,0), 5 round(12345.678,-1), 6 round(12345.678,-2) 7 from dual; ROUND(12345.678,2) ROUND(12345.678,1) ROUND(12345.678,0) ROUND(12345.678,-1) ------------------ ------------------ ------------------ ------------------- ROUND(12345.678,-2) ------------------- 12345.68 12345.7 12346 12350 12300
END