The LTRIM Function in Oracle SQL / PLSQL is used to remove the specified characters in a string from the left side.
Syntax for the using the LTRIM Function in Oracle SQL / PLSQL is:
SELECT LTRIM(string_1,[string_2])
FROM table_name;
- string_1 is the string which will be trimmed from the left side
- string_2 is the string which will be matched in string_1 for trimming, it’s an optional parameter, if omitted then LTRIM function will remove all the spaces in string_1from left side.
Examples:
Using LTRIM Function in Oracle SQL / PLSQL SELECT statement:
1 | SELECT LTRIM( 'Tech Honey' , 'T' ) |
2 | FROM dual; |
Will return ‘ech Honey’
1 | SELECT LTRIM( 'Tech Honey' , 'Tech' ) |
2 | FROM dual; |
Will return ‘Honey’
1 | SELECT LTRIM( ' Tech Honey' ) |
2 | FROM dual; |
Will return ‘Tech Honey’
1 | SELECT LTRIM( '56789Tech Honey' , '0123456789' ) |
2 | FROM dual; |
Will return ‘Tech Honey’
1 | SELECT LTRIM( '111111Tech Honey' , '1' ) |
2 | FROM dual; |
Will return ‘Tech Honey’