Skip to main content

RPAD

Returns the string str, right-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters.

Syntax​

RPAD(str,len,padstr)

Arguments​

ArgumentsDescription
strThe string.
lenThe length.
padstrThe pad string.

Return Type​

A number data type value.

Examples​

SELECT RPAD('hi',5,'?');
+--------------------+
| RPAD('hi', 5, '?') |
+--------------------+
| hi??? |
+--------------------+

SELECT RPAD('hi',1,'?');
+--------------------+
| RPAD('hi', 1, '?') |
+--------------------+
| h |
+--------------------+