21. 5. 11. PAD, RPAD, LPAD |
|
Add characters to a string |
RPAD is from the right side. |
LPAD is from the left side. |
v_tx:= lpad(string,length,extra string);
v_tx:= ltrim(string [,character]);
v_tx:= trim(LEADING|TRAILING|BOTH character from string);
|
|
SQL>
SQL> declare
2 v1_tx VARCHAR2(20):='Hello!';
3 v2_tx VARCHAR2(20);
4 v3_tx VARCHAR2(20);
5 begin
6 v2_tx:= rpad(lpad(v1_tx,10,'*'),15,'*');
7 DBMS_OUTPUT.put_line(v2_tx);
8 end;
9 /
****Hello!*****
PL/SQL procedure successfully completed.
SQL>
|
|