Example

Teradata Vantageā„¢ SQL Functions, Expressions, and Predicates

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

If the Names table includes the columns first_name and last_name, which contain the following information:

   first_name (CHAR(12)) has a value of 'Mary       '
   last_name (CHAR(12)) has a value of  'Jones      '

then this statement:

   SELECT TRIM (BOTH FROM last_name) || ', ' || TRIM(BOTH FROM first_name) 
   FROM names ;

returns the following string (note that the seven trailing blanks at the end of string Jones, and the eight trailing blanks at the end of string Mary are not included in the result):

   'Jones, Mary'

If the TRIM function is removed, the statement:

   SELECT last_name || ', ' || first_name 
   FROM names;

returns trailing blanks in the string:

   'Jones       , Mary        '