Share via:


Dear Readers,

In this article, we will learn about LTRIM FUNCTION IN TERADATA


Returns the string argument string1, with its left-most characters removed up to the first character that is not in the string argument string2.



The name of the database where the function is located.

string1 :

a character string or string expression.

string2 :

an optional string of characters that will be removed from string1.

If string2 is not specified, the default is to use a single space character.

ANSI Compliance

This is a Teradata extension to the ANSI SQL:2011 standard.

Argument Types and Rules

Expressions passed to this function must have the following data types:

  • string1 = VARCHAR or CLOB
  • string2 = VARCHAR

If any of the input arguments are NULL, the function returns NULL.

You can also pass arguments with data types that can be converted to the above types using the implicit data type conversion rules that apply to UDFs.

Note: The UDF implicit type conversion rules are more restrictive than the implicit type conversion rules normally used by Teradata Database. If an argument cannot be converted to the required data type following the UDF implicit conversion rules, it must be explicitly cast.

Result Type

The result data type and character set are the same as those of the string1 argument. For example, if the string1 argument has a data type of VARCHAR CHARACTER SET UNICODE, the result data type is VARCHAR CHARACTER SET UNICODE.


The following query returns the result ‘XxyLAST WORD’. LTRIM removes the individual occurrences of ‘x’ and ‘y’, and it stops removing characters when it encounters ‘X’ because ‘X’ is not in the string2 argument.


The following query returns the result ‘LEFT TRIM’. LTRIM removes the spaces from the left, and it stops removing characters when it encounters ‘L’ because ‘L’ is not in the string2 argument. Since the string2 argument is not explicitly specified, the default of a single space is used.


Thank you for giving your valuable time to read the above information.
Follow us on 
Facebook Page KTexperts
Linkedin Page : KT EXPERTS

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Add Comment