This Oracle tutorial explains how to use the Oracle/PLSQL LTRIM function with syntax and examples.
The Oracle/PLSQL LTRIM function removes all specified characters from the left-hand side of a string.
The syntax for the LTRIM function in Oracle/PLSQL is:
The string to trim the characters from the left-hand side.
Optional. The string that will be removed from the left-hand side of string1. If this parameter is omitted, the LTRIM function will remove all leading spaces from string1.
The LTRIM function returns a string value.
The LTRIM function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle LTRIM function examples and explore how to use the LTRIM function in Oracle/PLSQL.
For example:
The LTRIM function may appear to remove patterns, but this is not the case as demonstrated in the following example.
It actually removes the individual occurrences of 'x', 'y', and 'z', as opposed to the pattern of 'xyz'.
The LTRIM function can also be used to remove all leading numbers as demonstrated in the next example.
In this example, every number combination from 0 to 9 has been listed in the trim_string parameter. By doing this, it does not matter the order that the numbers appear in string1, all leading numbers will be removed by the LTRIM function.