DB2 Scalar functions - RTRIM
The RTRIM function removes any of the specified characters from the end of a string.
The RTRIM function removes any of the characters contained in a trim expression from the end of a string expression. The character search compares the binary representation of each character (consisting of one or more bytes) in the trim expression to the binary representation of each character (consisting of one or more bytes) at the end of the string expression. The database collation does not affect the search. If the string expression is defined as FOR BIT DATA or is a binary type, the search compares each byte in the trim expression to the byte at the end of the string expression.
The schema is SYSIBM. (The SYSFUN version of this function that uses a single parameter continues to be available with support for CLOB arguments.)
When a trim-expression is not specified, the data type of the string-expression determines the default value used:
The string-expression and trim-expression values must have compatible data types. If one of these arguments is a FOR BIT DATA character string, the other argument cannot be a graphic string (SQLSTATE 42846). A combination of character string and graphic string arguments can be used only in a Unicode database (SQLSTATE 42815).
The data type of the result depends on the data type of the string-expression.
The length attribute of the result data type is the same as the length attribute of the string-expression data type.
The actual length of the result for character or binary strings is the length of string-expression minus the number of string units removed. The actual length of the result for graphic strings is the length of string-expression minus the number of string units removed. If all of the characters are removed, the result is an empty string with a length of zero.
If any argument can be null, the result can be null; if any argument is null, the result is the null value.
VALUES RTRIM(:HELLO)
VALUES RTRIM('...$VAR$...', '$.')
'...$VAR'
VALUES RTRIM('((-78.0) )', '-0. ()')