TRIM is a string manipulation function that manipulates all string data types (BIT, BLOB, and CHARACTER), and removes trailing and leading singletons from a string.
TRIM returns a new string of the same type as source_string, in which the leading, trailing, or both leading and trailing singletons have been removed. The term singleton refers to a single part (BIT, BYTE, or CHARACTER) within a string of that type.
Character | ' ' (space) |
BLOB | X'00' |
Bit | B'0' |
If any parameter is NULL, the result is NULL.
It is often unnecessary to strip trailing blanks from character strings before comparison, because the rules of character string comparison mean that trailing blanks are not significant.
TRIM(TRAILING 'b' FROM 'aaabBb')returns 'aaabB'.
TRIM(' a ')returns 'a'.
TRIM(LEADING FROM ' a ')returns 'a '.
TRIM('b' FROM 'bbbaaabbb')returns 'aaa'.
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ak05270_ |