Trim Function; Considerations For Trim; Examples Of Trim - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

TRIM Function

The TRIM function removes leading and trailing characters from a character string. Every
character, including multibyte characters, is treated as one character.
TRIM ([[trim-type] [trim-char] FROM] trim-source)
trim-type is:
LEADING | TRAILING | BOTH
trim-type
specifies whether characters are to be trimmed from the leading end (LEADING), trailing
end (TRAILING), or both ends (BOTH) of trim-source. If you omit trim-type, the default
is BOTH.
trim_char
is an SQL character value expression and specifies the character to be trimmed from
trim-source. trim_char has a maximum length of 1. If you omit trim_char, SQL
trims blanks (' ') from trim-source.
trim-source
is an SQL character value expression and specifies the string from which to trim characters.
See
"Character Value Expressions" (page

Considerations for TRIM

Result of TRIM
The result is always of type VARCHAR, with maximum length equal to the fixed length or
maximum variable length of trim-source. If the source character string is an upshifts CHAR
or VARCHAR string, the result is an upshifts VARCHAR type.

Examples of TRIM

Return 'Robert':
TRIM ('
The EMPLOYEE table defines FIRST_NAME as CHAR(15) and LAST_NAME as CHAR(20).
This expression uses the TRIM function to return the value 'Robert Smith' without extra
blanks:
TRIM (first_name) || ' ' || TRIM (last_name)
480
SQL Functions and Expressions
Robert
')
255).

Advertisement

Table of Contents
loading

Table of Contents