RPAD
RPAD(string1, n[, string2])

Pads the right side of string1 with spaces or copies of the character string specified by string2 until the size of the resulting string reaches n characters.

Parameters

string1

Specifies the string that you want padded.

n

Specifies the number of characters you want in the result.

string2

Specifies the character sequence used to pad the input string to reach the desired length. This parameter defaults to a single space.

Example

SQL> SELECT RPAD('X',3), RPAD('X',3,'Y'), RPAD('RIGHT',12,'LEFT')
  2  FROM dual;

RPA RPA RPAD('RIGHT'
--- --- ------------
X   XYY RIGHTLEFTLEF

Get Oracle SQL: the Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.