TRIM function [String]

Function

Removes leading and trailing blanks from a string.

Syntax

TRIM ( string-expression )

Parameters

string-expression The string to be trimmed.

NoteThe result data type of a TRIM function is a LONG VARCHAR. If you use TRIM in a SELECT INTO statement, you must have a Large Objects Management option license, or use CAST and set TRIM to the correct data type and size.

See “REPLACE function [String]” for more information.

Example

The following statement returns the value “chocolate” with no leading or trailing blanks.

SELECT TRIM( '   chocolate   ' ) FROM iq_dummy

Standards and compatibility

See also

“LTRIM function [String]”

“RTRIM function [String]”