一,字符串函数
1,ascll (x) : 返回字符x的ASCLL 码
例:select ascll(a) from dual 结果:97
2,concat (x, y) : 把 x 和 y 连接成字符串
例:select concat(’‘Hello, ‘World’) 结果: HelloWorld
3,instr(s, str, [start, n]) : 从x中查询str, 可以指定从start 开始,也可以从n开始
例:select instr(‘helloworld’,‘l’) from dual; --返回结果:3 默认第一次出现“l”的位置
例2:select instr(‘hellowworld’, ‘l’, 2, 2) --返回结果:4 也就是说:在"helloworld"的第2(e)号位
置开始,查找第二次出现的“l”的位置
4,length(x) : 返回X的长度
例:select length(‘hello’) 结果:4
5,lower(x) : 把x转换成小写
例: select lower(‘HELLO’) 结果: hello
6,upper(x):把x转换成大写
例:select upper(‘hello’) 结果:HELLO
7,ltrim(x, str) 把x的左边截去 str 的字符串,str缺省值截去空格
例:select ltrim(’=Hello=’, ‘=’) 结果:Hello=
8,rtrim(x, str) 把x的右边截去 str 的字符串,str缺省值截去空格
数据库常用函数
最新推荐文章于 2023-05-14 17:59:53 发布