Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

LTRIM function (ODBC compatible)


LTRIM ( char_expression [ , char_set ] )


The scalar function LTRIM removes all the leading characters in char_expression, that are present in char_set and returns the resultant string. Thus, the first character in the result is guaranteed to be not in char_set. If the char_set argument is omitted, the function removes the leading and trailing blanks from char_expression.


SELECT name, LTRIM (addr, ' ')

FROM customer ;


  • The first and second arguments to the function must be of character type.
  • If one of the arguments is a literal and the other one a field reference, the operation is possible only if the literal is convertible to the character set of the field reference. Otherwise an error is returned.
  • The result is of character type whose character set is same as that of the arguments.
  • If the argument expression evaluates to null, the result is null.