Hi All,
I have a procedure which uses "utl_http" to send PDF file as E-mail which is generated on Oracle Reports server.
the procrdure is creted successfully. I have scheduled a job to execute this procedure on perticular time.
When i run the job 1st time it fails with error and 2nd time it executes successfully. It ha;ppens for every new login for the first time.
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 356
ORA-06512: at "SYS.HTP", line 1368
ORA-06512: at "SYS.HTP", line 1443
ORA-06512: at "SYS.HTP", line 1735
ORA-06512: at "AUTO_REP", line 28
ORA-06512: at line 2
Code:
v_blob blob;
v_url varchar2(2000);
v_pieces utl_http.html_pieces;
v_buffer raw(2000);
v_buffer_size integer := 2000;
begin
for v_rec in auto_cur loop
v_url := 'http://hostname/reports/rwservlet?'||v_rec.report_script ||'&desname='||v_rec.to_email_id||'&cc='||v_rec.cc_email_id||'&bcc='||v_rec.bcc_email_id;
htp.p('content-disposition: filename='||v_rec.report_nm);
owa_util.http_header_close;
utl_http.set_transfer_timeout(3600);
v_pieces := utl_http.request_pieces(v_url,64000);
v_blob := empty_blob();
dbms_lob.createtemporary(v_blob,true);
for i in 1 .. v_pieces.count loop
v_buffer := utl_raw.cast_to_raw(v_pieces(i));
v_buffer_size := utl_raw.length(v_buffer);
if v_buffer_size > 0 then
dbms_lob.writeappend(v_blob, v_buffer_size, v_buffer);
end if;
end loop;
wpg_docload.download_file(v_blob);
end loop;
end;
----
Pl help me resolving the issue.
Thanks & Regards,
Lucky.