LPAD – Left Pad in oracle
By Santhosh N
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
Oracle has a function by the name, LPAD which is used to pad the left side of the string with the specific set of characters.
Syntax: LPAD(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: LAPD('egg', 10)
This returns ‘ egg’ as the result.
Ex2: LPAD('egg', 2)
This returns ‘eg’ as the result
Ex3: LPAD('egg', 5, '1')
This returns ‘11egg’ 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 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 replace the part(s) of the string with other string or char
This explains how to find the length of the string in oracle
This explains how to convert one character set strings to other character set strings in oracle. Also, used to convert one data type to other in oracle
LPAD – Left Pad in oracle (3663 Views)