Thursday, November 30, 2006

 

Print CLOB to web

You can use this function:

procedure HtpPrn(pclob in out nocopy clob) is
v_excel varchar2(32000);
v_clob clob := pclob;
begin
while length(v_clob) > 0 loop
begin
if length(v_clob) > 16000 then
v_excel:= substr(v_clob,1,16000);
htp.prn(v_excel);
v_clob:= substr(v_clob,length(v_excel)+1);
else
v_excel := v_clob;
htp.prn(v_excel);
v_clob:='';
v_excel := '';
end if;
end;
end loop;
end;

Comments:
Thank you for sharing this, it's help me fix my problem in production environment very quickly
 
why 16000 ???
 
why 16000 indeed? also wouldn't it be more efficient to substring from a different starting position in the clob each iteration of the lop rather then copying the clob? but i guess it gets the job done...
 
Hello,

sorry for late response.
No reason for 16000. You can put 32k and it will work. Function htp.p is limited to 32k.


 
Thanks for the reply. Thanks for sharing proc.
 
Thansk a lot!!!!
 
Thansk a lot!!!!


 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?