Lower--转换为小写
upper--转换为大写
Initcap--首字母大写
concat--连接字符
substr--截取字符
length/length--获取字符串长度(字节长度)
instr--指定字符所在的位置
lpad/rpad--左/右填充
trim--去除字符串两端制定字符
replace--替换指定字符
Demo:
SQL> select lower('Hello WorLD'),upper('Hello WorLD'),initcap('Hello WorLD') from dual; LOWER('HELLOWORLD') UPPER('HELLOWORLD') INITCAP('HELLOWORLD')
------------------- ------------------- ---------------------
hello world HELLO WORLD Hello World SQL> select concat('Hello','world') from dual; CONCAT('HELLO','WORLD')
-----------------------
Helloworld SQL> select substr('Hello world',4),substr('Hello world',4,4) from dual; SUBSTR('HELLOWORLD',4) SUBSTR('HELLOWORLD',4,4)
---------------------- ------------------------
lo world lo w SQL> select length('Hello world'),lengthb('Hello world'),length('武汉'),lengthb('武汉') from dual; LENGTH('HELLOWORLD') LENGTHB('HELLOWORLD') LENGTH('武汉') LENGTHB('武汉')
-------------------- --------------------- -------------- ---------------
11 11 2 6 SQL> select instr('Hello world','w') from dual; INSTR('HELLOWORLD','W')
-----------------------
7 SQL> select lpad('Hello',10,'*'),rpad('Hello',10,'*') from dual; LPAD('HELLO',10,'*') RPAD('HELLO',10,'*')
-------------------- --------------------
*****Hello Hello***** SQL> select trim('H' from 'Hello world HHHH') from dual; TRIM('H'FROM'HELLOWORLDHHHH')
-----------------------------
ello world SQL> select replace('Hello world','l','*') from dual; REPLACE('HELLOWORLD','L','*')
-----------------------------
He**o wor*d