SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual—523725-004
9-79
LPAD Function
LPAD Function
The LPAD function replaces the leftmost specified number of characters in a character 
expression with a padding character.
LPAD is an SQL/MX extension.
character-expr 
is an SQL character value expression. The operand is the result of evaluating 
character-expr. See Character Value Expressions on page 6-39.
count 
specifies the number of characters to be replaced in character-expr. The 
number count must be a value greater than or equal to zero of exact numeric data 
type and with a scale of zero. The count must be less than or equal to the length 
of the evaluation of the character-expr.
pad-character 
specifies the padding character that replaces the leftmost count characters in the 
character expression character-expr. If no pad-character is specified, 
spaces is the padding character. For KANJI or KSC5601, the code value of 
pad-character is hexadecimal 2020.
Examples of LPAD
•
Replace 'Robert' with spaces:
LPAD ('Robert John Smith', 6)
•
Use the LPAD function to replace the first character of the job descriptions with 
'X':
UPDATE persnl.job 
SET jobdesc = LPAD (jobdesc, 1, 'X');
LPAD (character-expr,count [,pad-character]) 










