关于Oracle取整的函数
关于Oracle取整的函数分别有以下几种:
1.取整(大) select ceil(-1.001) value from dual 向大的进位
CEIL(-0.12)
-----------
0
2.取整(小) select floor(-1.001) value from dual 向小的进位
FLOOR(-0.12)
------------
-1
3.取整(截取) select trunc(-1.002) value from dual 直接截断小数点后的
TRUNC(3.2)
----------
3
SQL> SELECT TRUNC(3.8) FROM DUAL;
TRUNC(3.8)
----------
3
4.取整(舍入) select round(-1.001) value from dual
SQL> SELECT ROUND(-0.12) FROM DUAL;
ROUND(-0.12)
------------
0
SQL> SELECT ROUND(-0.812) FROM DUAL;
ROUND(-0.812)
-------------
-1
1.取整(大) select ceil(-1.001) value from dual 向大的进位
CEIL(-0.12)
-----------
0
2.取整(小) select floor(-1.001) value from dual 向小的进位
FLOOR(-0.12)
------------
-1
3.取整(截取) select trunc(-1.002) value from dual 直接截断小数点后的
TRUNC(3.2)
----------
3
SQL> SELECT TRUNC(3.8) FROM DUAL;
TRUNC(3.8)
----------
3
4.取整(舍入) select round(-1.001) value from dual
SQL> SELECT ROUND(-0.12) FROM DUAL;
ROUND(-0.12)
------------
0
SQL> SELECT ROUND(-0.812) FROM DUAL;
ROUND(-0.812)
-------------
-1
相关推荐
oraclemch 2020-11-06
Seandba 2020-08-16
dbasunny 2020-08-16
娜娜 2020-06-22
专注前端开发 2020-10-21
苏康申 2020-11-13
vitasfly 2020-11-12
liuyang000 2020-09-25
FellowYourHeart 2020-10-05
赵继业 2020-08-17
whyname 2020-08-16
拼命工作好好玩 2020-08-15
langyue 2020-08-15
写程序的赵童鞋 2020-08-03
Accpcjg 2020-08-02
tydldd 2020-07-30
好记忆也需烂 2020-07-28