Filling Substring with Spaces..!
500894Mar 12 2007 — edited Mar 13 2007Hi,
I have a requirement where i have to fill a string which is having
specific length with spaces and the result should have the same
number of spaces as the characters in the string..!
In my case the string is a numeric one..!
My program is as follows ...
But i am not getting the desired output..!
declare
l_sstr varchar2(11) := '12345678901';
l_mstr varchar2(11);
l_len number;
begin
l_len := length(l_sstr);
for i in 1..l_len
loop
l_mstr := l_mstr||translate(substr(l_sstr,i,1),'1234567890',CHR(32));
dbms_output.put_line(l_mstr);
dbms_output.put_line('length'||length(l_mstr));
end loop;
dbms_output.put_line('string'||l_mstr);
--dbms_output.put_line('length'||length(l_mstr));
end;
Thanks in Advance..