Oracle中分组函数的用法-----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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章