Skip to content

RPAD

  • str: This parameter refers to the string that needs to be right-padded with the specified characters.
  • len: This parameter signifies the total length of the resulting string after padding. If the ‘len’ specified is smaller than the length of the original string, it would be cut to the specified ‘len’.
  • padstr: This is the string that will be padded to the right of the original string. If the string of ‘padstr’ is not long enough to reach the total length ‘len’, it will be repeated until the required length is reached.
SELECT RPAD('SQL', 6, '1');
'SQL111'

In the above example, the RPAD function is used to pad the right side of the string ‘SQL’ to a length of 6 characters with the character ‘1’. The result is ‘SQL111’.