LPAD: Left-Padding a Character String

How to:

Reference:

LPAD uses a specified character and output length to return a character string padded on the left with that character.


Top of page

x
Syntax: How to Pad a Character String on the Left
LPAD(string, out_length, pad_character) 

where:

string

Fixed length alphanumeric

Is a string to pad on the left side.

out_length

Integer

Is the length of the output string after padding.

pad_character

Fixed length alphanumeric

Is a single character to use for padding.



Example: Left-Padding a String

LPAD left-pads the PRODUCT_CATEGORY column with @ symbols:

LPAD(PRODUCT_CATEGORY,25,'@')

For Stereo Systems, the output is @@@@@@@@@@@Stereo Systems.


Top of page

x
Reference: Usage Notes for LPAD

iWay Software