A case conversion function
1. Grammar
UPPER(char)
LOWER(char)
INITCAP (char)
2. Code
SQL>select upper('hdfsj'),lower('AJKLH'),initcap('fdsl')from dual;
UPPER LOWER INIT
--------------
HDFSJ ajklh Fdsl
Two get substring function
1. Grammar
n can be omitted. When n is omitted, it means to truncate from the position of n to the end of the string.
m is 0, which means to intercept from the first letter of the string.
m is a negative number, truncated from the end of the string.
2. Code
SQL>select substr('afhdjks',2,3),substr('dfhskjd',2),substr('fhsjkd',-2,1)from dual;
SUB SUBSTR S
----------
fhd fhskjd k
Three get string length function
1. Grammar
LENGTH(char)
2. Code
SQL>select length('asdf ')from dual;
LENGTH('ASDF')
--------------
5
Four String Concatenation Function
1. Grammar
CONCAT(char1,char2)
Same as || operator
2. Code
SQL>select concat('as','cd')from dual;
CONC
----
ascd
SQL>select'as'||'cd'from dual;
'AS'
----
ascd
Five remove substring function
1. Grammar
TRIM(c2 from c1): means to remove the string c2 from the string c1.
LTRIM(c1[,c2]): Remove c2 from the head of c1.
RTRIM
(c1[,c2]): removes c2 from the tail of c1.
TRIM(c1): Remove leading and trailing spaces.
2. Code
SQL>select trim('a'from'asdjfka')from dual;
TRIM(
-----
sdjfk
SQL>select ltrim('ababa','a')from dual;
LTRI
----
baba
SQL>select rtrim('ababaa','a')from dual;
RTRI
----
abab
Six Replacement Functions
1. Grammar
REPLACE(char,s_string[,r_string])
Omit r_string, replace with spaces
2. Code
SQL>select replace('abcdea','a','A')from dual;
REPLAC
------
AbcdeA
SQL>select replace('abcdea','a')from dual;
REPL
----
bcde
SQL>select replace('abced','ab','A')from dual;
REPL
----
Aced