The table below lists all the character functions available in Oracle and what they do.
Function | Syntax | Description |
CONCAT or || | CONCAT(col1, col2) or Col1 || col2 | Concatenates one column with another |
INITCAP | INITCAP(col1) | Capitalizes first letter of each word |
INSTR | INSTR(col1, c) | Returns the position of (c) in col1 |
LENGTH | LENGTH(col1) | Returns the length of col1 |
LOWER | LOWER(col1) | Converts all letters to lower case |
LPAD | LPAD(col1, n, c) | Add character (c) onto the left side of col1, repeating it until col1 is (n) characters long. You can list multiple characters in (c). |
LTRIM | LTRIM(col1 [,set]) | Remove characters listed in (set) from the left side of col1 until a character that is not in the set is found. Default for (set) is a blank space. |
REPLACE | REPLACE(col1, old, new) | Replace all occurrences of the old character with the new character. You can include multiple characters in the (old) and (new) parameters; similar to TRANSLATE . |
RPAD | RPAD(col1, n, c) | See LPAD ; this is the same except that it adds onto the right side of col1. |
RTRIM | RTRIM(col1 [,set]) | See LTRIM ; this is the same except that it works its way from the left to right. |
SOUNDEX | SOUNDEX(col1) | Convert col1 to a phonetic version of the word; allows you to compare words that sound alike but are spelled differently. |
SUBSTR | SUBSTR(col1, m [,n]) | Returns a part of col1; start at character in position (m) and continue for a length of (n) |
TRANSLATE | TRANSLATE(col1, old, new) | Changes old to new in col1 |
UPPER | UPPER(col1) | Converts col1 to upper case |
In the next lesson, you will learn the use of the character functions CONCAT, SUBSTR, LENGTH, and INSTR.