Displaying a BLOB/CLOB on the web
606275Aug 3 2009 — edited Aug 3 2009Greetings:
I have been having this issue for quite some time now in PL/SQL:
I am attempting to do the folllowing in my code:
One can upload a text file (Terms & Conditions text). The data gets saved temporarily as a BLOB in the database. I then would like to display this data for the user on the HTML page. I have tried various ways to do this.
I.e., via the dbms_lob.read function (while looping through) (that was one method). The other method I tried was to convert the BLOB to a CLOB and to then print the CLOB via the following procedure:
PROCEDURE p_print_clob (pv_text IN CLOB)
IS
lv_ptr number (7) := 1;
BEGIN
WHILE lv_ptr < LENGTH (pv_text)
LOOP
HTP.p (SUBSTR (pv_text, lv_ptr, 2000));
lv_ptr := lv_ptr + 2000;
END LOOP;
END p_print_clob;
No matter what, however, I always encounter the following error:
ORA-06502: PL/SQL: numeric or value error
I made sure that I am passing the right variables/data types and I am. It appears to be a size issue. How can I resolve this? Or, could you please help me to successfully display the contents of a file (saved to the database as a BLOB) on the HTML page? This issue has had me puzzled for quite some time now. Thanks in advance!