version 11
TRIM ({LEADING |TRAILING |BOTH} [arithmetic_expression] FROM arithmetic_expression)
TRIM (arithmetic_expression[FROM arithmetic_expression])
Description
The TRIM function removes empty spaces or specified characters from an arithmetic_expression.
In the first syntax, you can pass LEADING to indicate that the spaces/characters should be removed from the beginning of the arithmetic_expression, TRAILING to indicate that they should be removed from the end of it, or BOTH. The optional first arithmetic_expression passed indicates the specific characters to be removed from the second arithmetic_expression. If it is omitted, only the empty spaces will be removed.
In the second syntax, the first arithmetic_expression indicates the characters to be removed from the second optional arithmetic_expression. If this second optional arithmetic_expression is omitted, only the empty spaces will be removed from the arithmetic_expression passed.
Example
This example removes any empty spaces from the product names:
SELECT TRIM(Name) FROM PRODUCTS;
See Also