SQL single-line functions in Oracle databases-character Functions
This learning is about character functions.
Character Functions
Character functions can also be divided into case-insensitive conversion functions and character processing functions.
Case-sensitive conversion functions
1. LOWER: Convert to lower case [SQL] select LOWER ('oracle ') from dual; dual is a virtual table. We often use virtual tables for some related exercises.
2. UPPER: Convert to uppercase [SQL] select upper ('oracle ') from dual; 3. INITCAP: uppercase [SQL] select INITCAP ('oracle') from dual;
String processing functions
1. CONCAT: String concatenation function, similar to "|" [SQL] select concat (ename, 'employee ') from emp;
2. SUBSTR: String truncation function (tips: subscript starts from 1) [SQL] select substr (ename, 1, 3) from emp;
3. LENGTH: returns the string length [SQL] select LENGTH (ename) from emp; 4. INSTR: returns the position of a string in another string [SQL] select instr (ename, 'k') from emp; 5. Left fill for LPAD and RPAD, right fill for [SQL] select rpad (sal, 6, '*') from emp; -- do not fill "*" on the right side of the six-digit Database
-- Left filling is not demonstrated. However, it should be noted that if sal itself is null, it will not be filled.
6. TRIM: remove the specified characters (TIPS: this function is very powerful and will be mentioned later) [SQL] select TRIM ('S' from 'ssmith ') from emp; -- Here is a recursion"
7. REPLACE: replace the string [SQL] select REPLACE (ename, 'K % iritor ', 'oracle') from emp where ename = 'K % iritor ';
Tips: As can be seen from the above functions, these functions process a "record", so they are single-row functions.
Well, the built-in character functions are not listed yet, and you need to summarize them later.