TRIM in Teradata

TRIM function will cut the extra leading/trailing spaces associated with the string or number.

Input: string, numbers
Output: output by trimming/cutting the spaces in the input

Syntax:
SEL TRIM(string or number)

Example:
/* Trim example in teradata*/
SEL TRIM('Teradata ')

Result:  ‘Teradata’.


Note:
TRIM can be used similarly for the numbers and it will trim the spaces.
But it won’t accept any space between the numbers as in strings.

Few Forgetcode examples:

/* Trim example in teradata*/
SEL TRIM('Teradata  1  ')

Result:  ‘Teradata 1’


SEL TRIM(234  )

Result:  234   //(No spaces here) 


SEL TRIM(234 5)

Result:  Error 


SEL TRIM('234 5 ')

Result: '234 5'   //(Accepted as string) 


..