LPAD and RPAD#

Functionality:#

This Oracle function will justify and fill a passed character string to a specified size with an optionally sepecifed character

Parameters: #

STRING The source, or original, string
LENGTH The length you want the returned value to be
CHAR (optional) The character(s) you want any extra spaces to be filled with. If not provided, this will be a blank)

Returns: #

Text

Errors: #

None

Operations: #

If start position is 0, then start position is taken as 1

If start position is negative, then substr starts at the end and counts backwards

If length is negative, then NULL is returned

Example:#

lpad(~,12) will return, the passed string, right justified and padded on the left with blanks to a length of 12 characters.

lpad(~,12,'0') will return, the passed string, right justified and padded on the left with zeroes to a length of 12 characters.

rpad(~,8,'*') will return, the passed string, left justified and padded on the right with asterisks to a length of 8 characters.


Notes #

Click to create a new notes page