SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual540440-003
9-119
RIGHT Function
RIGHT Function
The RIGHT function returns the rightmost specified number of characters from a
character expression.
RIGHT is an SQL/MX extension.
character-expr
specifies the source string from which to return the rightmost specified number of
characters. The source string is an SQL character value expression. The operand
is the result of evaluating character-expr. See Character Value Expressions on
page 6-37.
count
specifies the number of characters to return from character-expr. The number
count must be a value of exact numeric data type with a scale of zero.
Examples of RIGHT
Return 'Smith':
RIGHT ('Robert John Smith', 5)
Suppose that a six-character company literal has been concatenated as the first
six characters to the job descriptions in the JOB table. Use the RIGHT function to
remove the company literal from the job descriptions:
UPDATE persnl.job
SET jobdesc = RIGHT (jobdesc, 12);
RIGHT (character-expr, count)