Skip to main content

String Functions

                                      STRING FUNCTIONS


Lower:-This function will return character,with all letter in lower case.
                       
     Example: SELECT LOWER('ANKIT') FROM DUAL;

NOTE:- "DUAL is demo table in SQL which contain one Row and one Column."

INITCAP:-This function will return string with the first letter in upper case.
             
     Example:SELECT INITCAP('ANKIT') FROM DUAL;

UPPER:-This function will return,with all leter to uppercase.

     Example:SELECT UPPER('Ankit') FROM DUAL;

SUBSTR:-This function will return the selected charcter from the string or a portion of charcter by mentioning the position of the character in the string.The starting charcter will be 'm' and exceeding upto 'n' result upto the end character.

     Example:SELECT SUBSTR('SECURE',2,4) FROM DUAL;

LTRIM:-This function will remove character from the left in the string.With initia character removed upto first character not in set.

     Example:SELECT LTRIM('ANKIT','A') FROM DUAL;

RTRIM:-This function will remove character from the right in the string.With final character removed after the last character not in set.

     Example:SELECT RTRIM('ANKIT','T') FROM DUAL;

LPAD:-This function will return the character left padded to length 'n'.
                    
     Example:SELECT LPAD('ANKIT',10,'*') FROM DUAL;

RPAD:-This function will return character right padded to length 'n' with the character in 'char2', replicated as many times as necessary.If 'char2' is omitted right-pad with blanks.

     Example:SELECT RPAD(NAME,10,'X') FROM CLIENT_MASTER WHERE                               NAME='ANKIT';                   

Comments