RPAD – Right Pad in oracle

By Santhosh N

This explains how to pad the specified number of character(s) on the right side of the string to return specified character length string in oracle

Oracle has a function by the name, RPAD which is used to pad the right side of the string with the specific set of characters.

Syntax: RPAD(str, len, [str_pad])

Here str is the original string, len is the number of characters to return, and str_pad is optional parameter which is padded with if specified.

Ex1: RAPD('egg', 10)
This returns ‘egg       ’ as the result.

Ex2: RPAD('egg', 2)
This returns ‘eg’ as the result

Ex3: RPAD('egg', 5, ‘1’)
This returns ‘egg11’ as the result

Note: If the len is smaller than the str, this truncates the string to the specified length and removes extra characters from the str on the right hand side (Ex2).

Related FAQs

This explains how to pad the specified number of character(s) on the left side of the string to return specified character length string in oracle
This explains how to trim the character(s) specified on the either side of the string
This explains how to trim the character(s) specified on the right hand side of the string
This explains how to trim the character(s) specified on the left hand side of the string
This explains how to convert first character of the word to the upper case and rest to the lower case.
This explains how to find the length of the string in oracle
RPAD – Right Pad in oracle  (2765 Views)