Try OpenEdge Now
skip to main content
SQL Reference
SQL Reference : OpenEdge SQL Functions : RPAD
 

RPAD

Pads the character string corresponding to the first argument on the right with the character string corresponding to the third argument. After the padding, the length of the result is equal to the value of the second argument length.

Syntax

RPAD ( char_expression, length[ , pad_expression] )

Example

This example illustrates two ways to use the RPAD function:
SELECT RPAD (last_name, 30)
FROM customer ;
SELECT RPAD (last_name, 30, '.')
FROM customer ;

Notes

*The first argument to the function must be of type CHARACTER. The second argument to the function must be of type INTEGER. The third argument, if specified, must be of type CHARACTER. If the third argument is not specified, the default value is a string of length 1 containing one blank.
*If L1 is the length of the first argument and L2 is the value of the second argument:
*If L1 is less than L2, the number of characters padded is equal to L2 minus L1.
*If L1 is equal to L2, no characters are padded and the result string is the same as the first argument.
*If L1 is greater than L2, the result string is equal to the first argument truncated to the first L2 characters.
*The result is of type CHARACTER.
*If the argument expression evaluates to NULL, the result is NULL.
*char_expression and pad_expressioncan contain multi‑byte characters. lengthrepresents the number of characters in the result.

Compatibility

Progress extension