This function is used to right pad str1 with str2 to the specified length.
rpad(string <str1>, int <length>, string <str2>)
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
str1 |
Yes |
STRING |
String to be right-padded |
length |
Yes |
INT |
Number of digits to be padded to the right |
str2 |
Yes |
STRING |
String used for padding |
The return value is of the STRING type.
The value hi??? is returned.
SELECT rpad('hi', 5, '??');
The value h is returned.
SELECT rpad('hi', 1, '??');