Home » SQL & PL/SQL » SQL & PL/SQL » how to assign a space ( ' ' ) to a variable
how to assign a space ( ' ' ) to a variable [message #39534] Mon, 22 July 2002 12:24
srg
Messages: 1
Registered: July 2002
Junior Member
the code below will accept a string from the user and pass it to this procedure and this will print in this manner
like @ p_string = ram
r
ra
ram

Create Or Replace Procedure sp_ang
( P_String varchar2
)
As
A varchar2(20) ;
B number ;
C varchar2(20) ;
D varchar2(20) ;
E number := 1 ;
W number := 1;
Begin
A := P_String ;
B := length ( A ) ;

For Tri in 1.. B Loop
C := substr (A,1,E) ;
Dbms_output.put_line(C) ;
-- Lpad (P_String , B - W , ' ' ) W := W - 1 ;
E := E +1 ;


End loop ;
End ;
/

no of spaces to be same as length os string
1st 1 char should be printed and no. space = length(string)-1

2nd 2 char and space = length (string)-2

so on char of the string should increase , and spaces should decrease .spaces should be in front of a string
in this pl/sql block..

plz rectify the block and give the correct answer
Previous Topic: Why I cannot execute my program when I use a prompt?
Next Topic: About insert data into a table which created in pl/sql
Goto Forum:
  


Current Time: Fri Apr 26 00:15:41 CDT 2024