LPAD 함수는 문자열이 일정 길이(byte)가 될 때까지 왼쪽에 특정 문자를 덧붙인다.
LPAD( char1, n, [, char2 ] )
char1 :
• character string
• string valued column
• NULL
n :
• integer
• NULL
char2 :
• character string
• NULL
--character set is euc-kr for Korean characters
--it returns only 3 characters if not enough length is specified
SELECT LPAD ('CUBRID', 3, '?');
======================
'CUB'
--on multi-byte charset, it returns the first character only with a left padded space
SELECT LPAD ('큐브리드', 3, '?');
======================
' 큐'
--padding spaces on the left till char_length is 10
SELECT LPAD ('CUBRID', 10);
======================
' CUBRID'
--padding specific characters on the left till char_length is 10
SELECT LPAD ('CUBRID', 10, '?');
======================
'????CUBRID'
--padding specific characters on the left till char_length is 10
SELECT LPAD ('큐브리드', 10, '?');
======================
'??큐브리드'
--padding 4 characters on the left
SELECT LPAD ('큐브리드', LENGTH('큐브리드')+4, '?');
======================
'????큐브리드'