文章目录
-
- -----round()用法与展示-----
- -----trunc()用法与展示-----
- -----floor()用法与展示-----
- -----ceil()用法与展示-----
- -----nvl()用法-----
- -----nvl2()用法-----
开始:
-----round()用法与展示-----
round处理数据四舍五入
select round(3.5) from dual;
select round(3.4) from dual;
小数点后可以调整精度
select round (1.2345,3) from dual;
-----trunc()用法与展示-----
trunc可以截取小数点后的某几位数字
select trunc(1.23456,4) from dual;
-----floor()用法与展示-----
floor取整
select floor(1.234) from dual;
-----ceil()用法与展示-----
ceil向上取整,一定大于或等于当前数
select ceil(1.234) from dual;
-----nvl()用法-----
nvl(x1,x2) ↓
x1不为null就返回x1,如果x1是null,就返回x2
-----nvl2()用法-----
nvl2(x1,x2.x3) ↓
x1不为null就返回x2,否则返回x3