RIGHT function [String]

Function

Returns the rightmost characters of a string.

Syntax

RIGHTstring-expression, numeric-expression )

Parameters

string-expression The string to be left-truncated.

numeric-expression The number of characters at the end of the string to return.

Example

The following statement returns the value “olate:”

SELECT RIGHT( 'chocolate', 5 ) FROM iq_dummy

Usage

If the string contains multibyte characters, and the proper collation is being used, the number of bytes returned might be greater than the specified number of characters.

NoteThe result data type of a RIGHT function is a LONG VARCHAR. If you use RIGHT in a SELECT INTO statement, you must have a Large Objects Management option license or use CAST and set RIGHT to the correct data type and size.

See “REPLACE function [String]” for more information.

Standards and compatibility

See also

“LEFT function [String]”

Chapter 11, “International Languages and Character Sets” in the System Administration Guide: Volume 1