Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue with printing CLOB using htp.prn

NattuMar 5 2013 — edited Mar 7 2013
Hi,

Oracel 11g R2
Apex 4.1

I got a reference from this forum on how to print CLOB data using htp.prn.

However when I run my procedure I get the error
 ORA-06502: PL/SQL: numeric or value error: character string buffer too small 
The clob length is 195734.

The code is
 

CREATE OR REPLACE PROCEDURE nat_test_lsp_ws_3
IS

   l_amt NUMBER DEFAULT 8191;
   l_offset NUMBER DEFAULT 1;
   l_length NUMBER DEFAULT 0;
   v_clob CLOB;
   
 
BEGIN

SELECT dbms_xmlgen.getxml('select * from table(pkg_bp_eisa.lsp_exa_ws(7))') into v_clob FROM dual;
 htp.htmlopen;
  htp.bodyopen;
  l_length := dbms_lob.getlength(v_clob);
  dbms_output.put_line('Length of Clob:='||l_length);
  IF l_length > 0 THEN 
  WHILE (l_offset < l_length)
  LOOP
   htp.prn(dbms_lob.substr(v_clob, l_amt, l_offset));
   l_offset := l_offset + l_amt;
  END LOOP;
  END IF;
  htp.bodyclose;
  htp.htmlclose;
  

EXCEPTION
   WHEN OTHERS THEN
   dbms_output.put_line(dbms_utility.format_error_stack);
   dbms_output.put_line(dbms_utility.format_error_backtrace);
   RAISE;

END;
I get the error on the line htp.prn...

However, if the clob size is too small, it is printing. Is there in any restriction in size for printing clob?

Thanks in advance.

Regards,

Natarajan
This post has been answered by joelkallman-Oracle on Mar 7 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 4 2013
Added on Mar 5 2013
13 comments
4,639 views