Oracle中的数值处理方法

  • 求绝对值函数
select abs(-5) from dual;

image

  • 求平方根函数
select sqrt(2) from dual;

image

  • 求幂函数
select power(2,3) from dual;

image

  • 求余弦三角函数
select cos(3.14159) from dual;

image

  • 求除法余数
select mod(1600, 300) from dual;

image

  • 求大于等于某数的最小整数
select ceil(2.35) from dual;

image

  • 求小于等于某数的最大整数
select floor(2.35) from dual;

image

  • 按指定精度对十进制数四舍五入
select round(45.923, 1) from dual;

image

select round(45.923,-1) from dual;

image

  • 按指定精度截断十进制数
select trunc(45.923, 1) from dual;

image

select trunc(45.923, -1) from dual;

image

  • 四舍五入函数
SELECT round(45.923,2), round(45.923,0), round(45.923, -1) FROM dual;

image

数值处理函数还有很多,比如:

SIN,SINH,COS,COSH,TAN,TANH, ACOS, ATAN, ATAN2和ASIN

我在这里就不一一介绍了,希望对大家有帮助。

最近在学习oracle,我会把我学习到的知识与大家分享。

转载请注明出处:http://www.cnblogs.com/yydcdut/p/3643796.html

原文地址:https://www.cnblogs.com/yydcdut/p/3643796.html