6.LPAD(expr1,n,expr2):- LPAD returns expr1, left-padded to length n characters with the
sequence of characters in expr2. This function is useful for formatting the output of a query.
Eg:- SELECT LPAD('Page 1',13,'*.') "LPAD example" FROM DUAL; o/p:- *.*.*.*Page 1
7.RPAD(expr1,n,expr2):- RPAD returns expr1, right-padded to length n characters
with expr2, replicated as many times as necessary. This function is useful for formatting the
output of a query.
Eg:- SELECT RPAD('Page 1',15,'*.') "LPAD example" FROM DUAL;
o/p:- Page 1*.*.*.*.*
8.LTRIM(char, set):- LTRIM removes from the left end of char all of the characters
contained in set. If you do not specify set, it defaults to a single blank. If char is a character
literal, then you must enclose it in single quotes. Oracle Database begins
scanning char from its first character and removes all characters that appear in setuntil
reaching a character not in set and then returns the result.
Eg:- SELECT ltrim('xyzabc','xyz') FROM DUAL; o/p:- abc
9.RTRIM(char, set):- RTRIM removes from the right end of char all of the characters that
appear in set. This function is useful for formatting the output of a query. If you do not
specify set, then it defaults to a single blank. If char is a character literal, then you must
enclose it in single quotes. RTRIM works similarly to LTRIM.
Eg:- SELECT rtrim('xyzabc',‘abc') FROM DUAL; o/p:- xyz
10.TRIM(char):- TRIM removes from both sides (left and right)
Eg:- SELECT trim(' xyzabcxyz ') FROM DUAL; o/p:- xyzabcxyz
11.SOUNDEX(char):-SOUNDEX returns a character string containing the phonetic
representation of char. This function lets you compare words that are spelled differently, but
sound alike in English.
Eg:- SELECT soundex('SMYTHE') FROM DUAL; o/p:- S530
12.SUBSTR(char,position,substring_length):- The SUBSTR functions return a portion
of char, beginning at character position, substring_length characters
long. SUBSTR calculates lengths using characters as defined by the input character set.
If position is 0, then it is treated as 1.
Eg:- SELECT SUBSTR('ABCDEFG',3,4) "Substring" FROM DUAL; o/p:- CDEF
Eg:- SELECT SUBSTR('ABCDEFG',-5,4) "Substring" FROM DUAL; o/p:- CDEF
13.TRANSLATE(expr, from_string, to_string):- TRANSLATE function replaces a
sequence of characters in a string with another set of characters. However, it replaces a
single character at a time. For example, it will replace the 1st character in
the string_to_replace with the 1st character in the replacement_string. Then it will replace
the 2nd character in the string_to_replace with the 2nd character in the replacement_string,
and so on.
Stntax:- TRANSLATE( string1, string_to_replace, replacement_string )
PARAMETERS OR ARGUMENTS
string1 is the string to replace a sequence of characters with another
set of characters.
string_to_replace is the string that will be searched for in string1.