forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
6.8 KiB
6.8 KiB
rpad
This function is used to right pad str1 with str2 to the specified length.
Syntax
rpad(string <str1>, int <length>, string <str2>)
Parameters
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 |
Return Values
The return value is of the STRING type.
Example Code
The value hi??? is returned.
SELECT rpad('hi', 5, '??');
The value h is returned.
SELECT rpad('hi', 1, '??');
Parent topic: String Functions