DECLARE
BEGIN
For I in 1..9 loop
Dbms_output.put_line (To_char (i) | | Rpad (' * ', I, ' * '));
End LOOP;
End;
Get the result for
1*
2**
3***
4****
5*****
6******
7*******
8********
9*********
Where: Rpad usage is as follows
The Rpad function populates the string on the right with some specific characters in the following syntax format:
Rpad (string,n,[pad_string])
String: But character or argument
N: The length of the character is the number of returned strings, if this number is shorter than the length of the original string, the Lpad function will intercept the string into N characters from left to right;
Pad_string: is an optional argument, the string is pasted to the right of the string, and if this argument is not written, the Lpad function will paste a space on the right side of the string.
For example:
Rpad (' Tech ', 7); will return to ' tech '
Rpad (' Tech ', 2); will return ' Te '
Rpad (' Tech ', 8, ' 0 '); will return to ' tech0000 '
Rpad (' Tech on the net ', ' Z '); Will return ' Tech on ' net '
Rpad (' Tech on the net ', ' Z '); Will return ' tech on the Netz '
The Lpad function populates the left string with some specific characters in the following syntax format:
Lpad (string,n,[pad_string])
String: But character or argument
N: The length of the character is the number of returned strings, if this number is shorter than the length of the original string, the Lpad function will intercept the string into N characters from left to right;
Pad_string: is an optional argument, the string is pasted to the left of the string, and if this argument is not written, the Lpad function will paste a space on the left side of the string.
For example:
Lpad (' Tech ', 7); will return to ' tech '
Lpad (' Tech ', 2); will return ' Te '
Lpad (' Tech ', 8, ' 0 '); will return ' 0000tech '
Lpad (' Tech on the net ', ' Z '); Will return ' Tech on ' net '
Lpad (' Tech on the net ', ' Z '); will return ' Ztech on ' net '