orcale中数字取整函数、保留小数函数

1. 向下取整

例如:

select floor(123.95689) from dual 结果:123

select floor(123.35689) from dual 结果:123

 2.向上取整 例如:

select ceil(123.95689) from dual 结果:124

select ceil(123.15689) from dual 结果:124

3.四舍五入保留n位小数:

select round(123.55689,0) from dual 结果:124

select round(123.45689,0) from dual 结果:123

select round(123.55689) from dual 结果:123 也就是说,如果不保留小数位数,可以直接写数值

select round(123.55689,2) from dual 结果:123.56

select round(123.55649,3) from dual 结果:123.556

4.不是四舍五入,直接摄取若干小数位:

select trunc(123.55689,3) from dual 结果:123.556

select trunc(123.55689,0) from dual 结果:123

select trunc(123.55689) from dual 结果:123

你可能感兴趣的:(orcale中数字取整函数、保留小数函数)