110个oracle常用函数大全(11-20)

发布时间:2020-03-12编辑:脚本学堂
110个oracle常用函数大全(11-20)

11.SUBSTR(string,start,count)
取子字符串,start开始,count
SQL> select substr(13088888888,3,8) from dual;
SUBSTR(
--------
08888888

12.REPLACE(string,s1,s2)
string
希望被替换的字符或变量
s1
被替换的字符串
s2
要替换的字符串
SQL> select replace(he love you,he,i) from dual;
REPLACE(H
----------
i love you

13.SOUNDEX
返回一个与给定的字符串读音相同的字符串
SQL> create table table1(xm varchar(8));
SQL> insert into table1 values(weather);
SQL> insert into table1 values(wether);
SQL> insert into table1 values(gao);
SQL> select xm from table1 where soundex(xm)=soundex(weather);
XM
--------
weather
wether
• 14.TRIM(s from string)
LEADING
剪掉前面的字符
TRAILING
剪掉后面的字符
如果不指定,默认为空格符
15.ABS
返回指定值的绝对值
SQL> select abs(100),abs(-100) from dual;
ABS(100) ABS(-100)
--------- ---------
100 100

16.ACOS
给出反余弦的值
SQL> select acos(-1) from dual;
ACOS(-1)
---------
3.1415927

17.ASIN
给出反正弦的值
SQL> select asin(0.5) from dual;
ASIN(0.5)
---------
.52359878

18.ATAN
返回一个数字的反正切值
SQL> select atan(1) from dual;
ATAN(1)
---------
.78539816

19.CEIL
返回大于或等于给出数字的最小整数
SQL> select ceil(3.1415927) from dual;
CEIL(3.1415927)
---------------
4

20.COS
返回一个给定数字的余弦
SQL> select cos(-3.1415927) from dual;
COS(-3.1415927)
---------------
-1