RTRIM Function
Element | Description | Restrictions | Syntax |
---|---|---|---|
pad_string | Expression that specifies one or more characters to delete from source_string | Must be a character expression | Expression |
source_string | Expression that specifies a character string from which characters in pad_string are deleted | Pad characters to the left of any character not in pad_string are not deleted | Expression |
The first argument to the RTRIM function must be a character expression from which to delete trailing pad characters. The optional second argument is a character expression that evaluates to a string of pad characters. If no second argument is provided, only blank characters are regarded as pad characters.
The return data type of the LTRIM function is based on its source_string argument, using the return type promotion rules that the section Return Types from the CONCAT Function describes.
The value returned contains a substring of source_string, but from which any trailing pad characters to the right of the first non-pad character have been removed. If a host variable is used, an LVARCHAR data type is returned.
The RTRIM function scans a copy of the source_string from the right, deleting any trailing characters that appear in the pad_string. If no pad_string argument is specified, only trailing blanks are deleted from the returned value. When the first non-pad character is encountered, the function returns its result string and terminates.
'
theend!*#?'
: SELECT RTRIM('good night... *!#?theend ', ' theend!*#?') AS closing FROM mytab;
(constant) |
---|
good night... |
.
)
characters, which preserved the leading 'thn'
pad
characters to the left.