本文总结了Oracle数学相关函数。分享给大家供大家参考,具体如下:
1.绝对值:abs()
1
|
select abs (-2) value from dual; |
2.取整函数(大):ceil()
1
|
select ceil(-2.001) value from dual;(-2) |
3.取整函数(小):floor()
1
|
select floor(-2.001) value from dual;(-3) |
4.取整函数(截取):trunc()
1
|
select trunc(-2.001) value from dual; (-2) |
5.四舍五入:round()
1
|
select round(1.234564) value from dual;(1.2346) |
6.取平方:Power(m,n)
1
|
select power(4,2) value from dual;(16) |
7.取平方根:SQRT()
1
|
select sqrt(16) value from dual;(4) |
8.取随机数:dbms_random(minvalue,maxvalue)
1
|
select sys.dbms.random.value(0,1) value from dual; |
9.取符号:Sign()
1
|
select sign(-3) value from dual;(-) |
10,取集合的最大值:greatest(value)
1
|
select greatest(-1,3,5,7,9) value from dual;(9) |
11.取集合的最小值:least(value)
1
|
select least(-1,3,5,7,9) value from dual;(-1) |
12.处理Null值:nvl(空值,代替值)
1
|
select nvl( null ,10) value from dual;(10) |
13.求字符序号:ascii()
1
|
select ascii(a) value from dual; |
14.求序号字符:chr()
1
|
select chr(97) value from dual; |
15.链接:concat()
1
|
select concat( "11" , "22" ) value from dual;(1122) |
16.获取系统时间:sysdate()
1
|
select sysdate value from dual; |
17.求日期
1
|
select trunc(sysdate) from dual; |
18.求时间
1
|
select to_char(sysdate, "hh24:mm:ss" ) from dual; |
19.首字母大写:InitCAP()
1
|
select INITCAP(abc def ghi) value from dual;(Abc Def Ghi) |
希望本文所述对大家Oracle数据库程序设计有所帮助。