示例1:
SQL> select lpad('abcde',10,'x') from dual;
LPAD('ABCDE',10,'X')
--------------------
xxxxxabcde
示例2:
SQL> select lpad('abcde',2) from dual;
LPAD('ABCDE',2)
---------------
ab
rpad函数从右边对字符串使用指定的字符进行填充,语法格式与lpad格式相同
示例:
rpad('tech', 2); 将返回'te'
rpad('tech', 8, '0'); 将返回'tech0000'
rpad('tech on the net', 15, 'z'); 将返回 'tech on the net'
rpad('tech on the net', 16, 'z'); 将返回 'tech on the netz'