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

SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual540440-003
9-122
RPAD Function
RPAD Function
The RPAD function replaces the rightmost specified number of characters in a
character expression with a padding character.
RPAD is an SQL/MX extension.
character-expr
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 be replaced in character-expr. The
number count must be a value greater than or equal to zero of exact numeric data
type and with a scale of zero. The count must be less than or equal to the length
of the evaluation of the character-expr.
pad-character
specifies the padding character that replaces the rightmost count characters in
the character expression character-expr. If no pad-character is specified,
spaces is the padding character.
Examples of RPAD
Replace 'Smith' with spaces:
RPAD ('Robert John Smith', 5)
Use the RPAD function to replace the last character of the job descriptions with
'X':
UPDATE persnl.job
SET jobdesc = RPAD (jobdesc, 1, 'X');
RPAD (character-expr,count [,pad-character])