Database Reference
In-Depth Information
LPAD('oracle',10,'X') = 'XXXXoracle'
RPAD('oracle',10,'X') = 'oracleXXXX'
Note:
Padding a string is sometimes referred to as filling a string.
TRIM([[LEADING|TRAILING|BOTH]
character
FROM]
expression), LTRIM(expression, string-set),
and
RTRIM(expres-
sion, string-set)
. LTRIM and RTRIM will remove from the left and
the right of the string, respectively, any characters contained within
the string set, until a character not in the string set is found. The
LTRIM and RTRIM functions are less useful than the TRIM func-
tion. TRIM will remove characters from the string from the left, the
right, or both. In its simplest form, TRIM can be used to remove
leading and trailing spaces from a string.
TRIM(' oracle ') = 'oracle'
Remember that spaces embedded between other characters do not
get removed, until a character not in the string set is found. As a
result, for the next example there is no change.
TRIM(' o r a c l e ') = 'o r a c l e'
TRIM( LEADING '-' FROM '---608-444-3029') = '608-444-3029'
REPLACE(expression, search [, replace])
and
TRANS-
LATE(expression, search [, replace])
. REPLACE will replace every
occurrence of the search string with the replacement string. Where
the REPLACE function matches any search string within the string,
TRANSLATE will match each character between the search and
replace strings by the position of characters in both the search and
replace strings. Phew! In simple terms, REPLACE replaces groups of
characters and TRANSLATE translates individual characters.
REPLACE(' o r a c l e',' ','') = 'oracle'
REPLACE('My dog has fleas.','as','odd')
= 'My dog hodd fleodd.'
In the first TRANSLATE function example following, nothing is
changed because the space in the search string has no corresponding
value in the replace string.
TRANSLATE(' o r a c l e ','oracle ','12345X')
= '12345X'
TRANSLATE('My dog has fleas.','agf','AGF')
= 'My doG hAs FleAs.'
 
Search WWH ::




Custom Search