LTRIM Function

LTRIM

  • This will trim off unwanted characters from the left sides of string.
  • This will remove all the specific characters from left side of string.

Syntax: ltrim (string [,unwanted_chars])

Ex:

select ltrim('computer','co'), ltrim('computer','com') from dual;

output

ltrim('computer','co')
------------------------
mputer

ltrim('computer','com')
------------------------
puter
LTRIM function in SQL
LTRIM function in SQL

some more example

select ltrim('   tech') from dual;
------------------------------------
tech
select ltrim('   tech',' ') from dual;
----------------------------------------
tech
select ltrim('123123tech','123') from dual;
-------------------------------------------
tech
select ltrim('000tech','0') from dual;
----------------------------------------
tech
select ltrim('xyxzyyytech','xyz') from dual;
---------------------------------------------
tech
select ltrim('6372tech','0123456789') from dual;
--------------------------------------------------
tech

Leave a Reply