IBM Books

SQL Reference

RTRIM

>>-RTRIM--(--string-expression--)------------------------------><
 

The schema is SYSIBM. 43

The RTRIM function removes blanks from the end of string-expression.

The argument can be a CHAR, VARCHAR, GRAPHIC, or VARGRAPHIC data type.

The result data type of the function is:

The length parameter of the returned type is the same as the length parameter of the argument data type.

The actual length of the result for character strings is the length of string-expression minus the number of bytes removed for blank characters. The actual length of the result for graphic strings is the length (in number of double byte characters) of string-expression minus the number of double byte blank characters removed. If all of the characters are removed, the result is an empty, varying-length string (length is zero).

If the argument can be null, the result can be null; if the argument is null, the result is the null value.

Example: Assume that host variable HELLO is defined as CHAR(9) and has a value of 'Hello '.

  VALUES RTRIM(:HELLO) 

The result is 'Hello'.


Footnotes:

43
The SYSFUN version of this function continues to be available with support for LONG VARCHAR and CLOB arguments. See RTRIM (SYSFUN schema) for a description.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]