C/C++教程

Oracle常用字符串函数

本文主要是介绍Oracle常用字符串函数,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
#(1)转换大写
select upper('HEllo') from dual;	#HELLO
#(2)转换为小写
select lower('HEllo') from dual;		#hello
#(3)首字母大写
select initcap('HEllo') from dual;	#Hello
#(4)截取字符串
select substr('Hello World',1,7) from dual;	#Hello W
#(5)字符串长度
select length('Hello World') from DUAL;	#11
#(6)定位子串
select instr('Hello World','l',-1,2) from dual;	#4
#(7)左侧填充
select lpad('Hello World',20,'55') from  dual;	#555555555Hello World
#(8)右侧填充
select rpad('Hello World',20,'55') from  dual;	#Hello World555555555
#(9)去除收尾空格
select trim('  HEllo ') from dual;	#HEllo
#(10)字符串替换
Select replace('Hello World','l','拉') from dual;	#He拉拉o Wor拉d
#(11)绝对值
select abs('-6.58') from dual;	#6.58
#(12)四舍五入
select round('44154646.154',-2) from dual;	#44154600
#(13)截断
select trunc('3.1415',2) from dual;	#3.14
#(14)向上取整
select ceil(3.14) from dual;	#4
#(15)向下取整
select floor(3.14) from dual;	#3
#(16)判断数值正负
select sign(1) from dual;	#1
#(17)三角函数
select sin(3.14) from dual;	#0.00159265291648695254054143632444326146
#(18)幂运算
select power(4,2) from dual;	#16
#(19)开平方根
select sqrt(16) from dual;	#4
#(20)取模
select mod(15,8) from dual;	#7
#(20)基数为e的幂运算exp(1)
select exp(4) from dual;	#54.59815003314423907811026120286087840308
#(21)对数运算
select log(4,16) from dual;	#2.00000000000000000000000000000000000001
#(22)自然对数运算
select ln(7) from dual;	#1.94591014905531330510535274344317972964
#(23)字符串连接
select concat('Hello','World') from dual;	#HelloWorld
这篇关于Oracle常用字符串函数的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!