标签:
Lower--转换为小写
upper--转换为大写
Initcap--首字母大写
concat--连接字符
substr--截取字符
length/length--获取字符串长度(字节长度)
instr--指定字符所在的位置
lpad/rpad--左/右填充
trim--去除字符串两端制定字符
replace--替换指定字符
Demo:
1 SQL> select lower(‘Hello WorLD‘),upper(‘Hello WorLD‘),initcap(‘Hello WorLD‘) from dual; 2 3 LOWER(‘HELLOWORLD‘) UPPER(‘HELLOWORLD‘) INITCAP(‘HELLOWORLD‘) 4 ------------------- ------------------- --------------------- 5 hello world HELLO WORLD Hello World 6 7 SQL> select concat(‘Hello‘,‘world‘) from dual; 8 9 CONCAT(‘HELLO‘,‘WORLD‘) 10 ----------------------- 11 Helloworld 12 13 SQL> select substr(‘Hello world‘,4),substr(‘Hello world‘,4,4) from dual; 14 15 SUBSTR(‘HELLOWORLD‘,4) SUBSTR(‘HELLOWORLD‘,4,4) 16 ---------------------- ------------------------ 17 lo world lo w 18 19 20 SQL> select length(‘Hello world‘),lengthb(‘Hello world‘),length(‘武汉‘),lengthb(‘武汉‘) from dual; 21 22 LENGTH(‘HELLOWORLD‘) LENGTHB(‘HELLOWORLD‘) LENGTH(‘武汉‘) LENGTHB(‘武汉‘) 23 -------------------- --------------------- -------------- --------------- 24 11 11 2 6 25 26 SQL> select instr(‘Hello world‘,‘w‘) from dual; 27 28 INSTR(‘HELLOWORLD‘,‘W‘) 29 ----------------------- 30 7 31 32 SQL> select lpad(‘Hello‘,10,‘*‘),rpad(‘Hello‘,10,‘*‘) from dual; 33 34 LPAD(‘HELLO‘,10,‘*‘) RPAD(‘HELLO‘,10,‘*‘) 35 -------------------- -------------------- 36 *****Hello Hello***** 37 38 SQL> select trim(‘H‘ from ‘Hello world HHHH‘) from dual; 39 40 TRIM(‘H‘FROM‘HELLOWORLDHHHH‘) 41 ----------------------------- 42 ello world 43 44 SQL> select replace(‘Hello world‘,‘l‘,‘*‘) from dual; 45 46 REPLACE(‘HELLOWORLD‘,‘L‘,‘*‘) 47 ----------------------------- 48 He**o wor*d
标签:
原文地址:http://www.cnblogs.com/liuwt365/p/4180286.html