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

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