Thursday, February 16, 2012

How to trim spaces without using trim function in oracle?

Here is the code for the same
=============================

declare

v_str varchar2(20):=' ABCD ';
v_final varchar2(20);
pos pls_integer:=1;
begin

while pos <=length(v_str)
LOOP
if (substr(v_str,pos,1) != chr(32))
then
v_final := concat(v_final , substr(v_str,pos,1));
end if;
pos :=pos+1;
END LOOP;

dbms_output.put_line(v_final);

end;

No comments:

Post a Comment