Share this page:

oracle tutorial

Oracle/PLSQL: RPAD Function

This Oracle tutorial explains how to use the Oracle/PLSQL RPAD function with syntax and examples.


The Oracle/PLSQL RPAD function pads the right-side of a string with a specific set of characters (when string1 is not null).


The syntax for the Oracle/PLSQL RPAD function is:

RPAD( string1, padded_length, [ pad_string ] )

Parameters or Arguments

string1 is the string to pad characters to (the right-hand side).

padded_length is the number of characters to return. If the padded_length is smaller than the original string, the RPAD function will truncate the string to the size of padded_length.

pad_string is optional. This is the string that will be padded to the right-hand side of string1. If this parameter is omitted, the RPAD function will pad spaces to the right-side of string1.

Applies To

The RPAD function can be used in the following versions of Oracle/PLSQL:

  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i


Let's look at some Oracle RPAD function examples and explore how to use the RPAD function in Oracle/PLSQL.

For example:

RPAD('tech', 7)
Result: 'tech   '

RPAD('tech', 2)
Result: 'te'

RPAD('tech', 8, '0')
Result: 'tech0000'

RPAD('tech on the net', 15, 'z')
Result: 'tech on the net'

RPAD('tech on the net', 16, 'z')
Result: 'tech on the netz'