TRIM

The TRIM function returns the given string after it removes leading and trailing spaces.

Syntax

TRIM([{LEADING | TRAILING | BOTH} <trim_char> FROM] <string>)

Description

The TRIM function removes leading and trailing spaces from a given string. The trim operation works from the start (LEADING), end (TRAILING) or both (BOTH) ends of the string. The following list describes how the TRIM function works under specific situations:
  • If either <string> or <trim_char> is NULL, then TRIM returns NULL.

  • If no options are specified, TRIM removes both the leading and trailing substring specified in <trim_char> from the given string.

  • If <trim_char> isn't specified, then TRIM uses a single blank space.