LTRIM – Left Trim in oracle

By Santhosh N

This explains how to trim the character(s) specified on the left hand side of the string

Oracle has a function by the name, LTRIM used to remove the specified character(s) from the left hand side of the string.

Syntax: LTRIM(str [, TrimString] )

Here str is the original string and TrimString is the string that needs to be removed from the left hand side of the str. However, this second parameter being optional, if not specified it removes all the leading spaces from str.

Ex1: LTRIM(‘555egg555’,’555’)
This returns ‘egg555’ as the result.

Ex2: LTRIM(‘      EggHead22’)
This returns ‘EggHead’ as the result.

Ex3: LTRIM(‘sssEggHead’, ‘s’)
This returns ‘EggHead’ as the result

Note: LTRIM not only replaces the entire string mentioned as second parameter from the original string but it removes individual occurrences of the characters mentioned in the second parameter.

Ex4: LTRIM(‘1234EggHead’,’0123456789’)
This returns ‘EggHead’ by removing all numbers

Related FAQs

This explains how to replace the part(s) of the string with other string or char
This explains how to convert all the characters to the upper case alphabets
This explains how to convert all the characters to the lower case alphabets
This explains how to find the length of the string in oracle
This explains how to convert first character of the word to the upper case and rest to the lower case.
This explains how to convert one character set strings to other character set strings in oracle. Also, used to convert one data type to other in oracle
LTRIM – Left Trim in oracle  (2393 Views)