trunc(exp1)
trunc(exp1)和Round(exp1,exp2)类似,只不过trunc()不指定截取的小数位数进行处理,只取到整数位,不做舍去处理
select trunc(123.1234) from dual ---123 select trunc(123.9234) from dual ---123
-----Round(exp1,exp2)函数具有四舍五入的功能,分为以下两种情况 ---exp2数为非负,四舍五入的位数从小数点后开始计数,小数点后|exp2|位,看後一位,进本位,后面舍去 select Round(125.455,0) from dual ---125 select Round(125.455,1) from dual ---125.5 select Round(125.455,4) from dual ---125.455 大于小数位数,其余的位数补0将不显示 ---exp2数为负,四舍五入的位数从小数点前开始计数,小数点前|exp2|位,看本位,进前一位,本位以及后面取0 select Round(125.455,-1) from dual ---130 select Round(125.455,-2) from dual ---100 select Round(125.455,-3) from dual ---0 select Round(125.455,-4) from dual ---0