Estou precisando de uma ajuda, estou tendo um problema conforme o nome do tópico:
ORA-06502: PL/SQL: numeric or value error, e consequentemente ele gera o erro ORA-06512.
Segue código
procedure Output(pname varchar2 default null,pdest varchar2 default null) is
myName word := pname;
myDest word := pdest;
v_doc blob; -- finally complete document
v_blob blob;
v_clob clob;
v_in pls_integer;
v_out pls_integer;
v_lang pls_integer;
v_warning pls_integer;
v_len pls_integer;
begin
dbms_lob.createtemporary(v_blob, false, dbms_lob.session);
dbms_lob.createtemporary(v_doc, false, dbms_lob.session);
-- Output PDF to some destination
-- Finish document if necessary
if state < 3 then
ClosePDF();
end if;
myDest := strtoupper(myDest);
if(myDest is null) then
if(myName is null) then
myName := 'doc.pdf';
myDest := 'I';
else
myDest := 'D';
end if;
end if;
if (myDest = 'I') then
-- Send as pdf to a browser
OWA_UTIL.MIME_HEADER('application/pdf',false);
htp.print('Content-Length: ' || getPDFDocLength());
htp.print('Content-disposition: inline; filename="' || myName || '"');
owa_util.http_header_close;
-- restitution du contenu...
v_len := 1;
for i in pdfDoc.first..pdfDoc.last loop
v_clob := to_clob(pdfDoc(i));
if v_clob is not null then
v_in := 1;
v_out := 1;
v_lang := 0;
v_warning := 0;
v_len := dbms_lob.getlength(v_clob);
dbms_lob.convertToBlob(v_blob, v_clob, v_len,
v_in, v_out,
dbms_lob.default_csid, v_lang, v_warning);
dbms_lob.append(v_doc, dbms_lob.substr(v_blob, v_len));
end if;
end loop;
wpg_docload.download_file(v_doc);
elsif (myDest = 'D') then
-- Download file
if(not empty(owa_util.get_cgi_env('HTTP_USER_AGENT')) and instr(owa_util.get_cgi_env('HTTP_USER_AGENT'),'MSIE') > 0) then
OWA_UTIL.MIME_HEADER('application/force-download',false);
else
OWA_UTIL.MIME_HEADER('application/octet-stream',false);
end if;
htp.print('Content-Length: ' || getPDFDocLength());
htp.print('Content-disposition: attachment; filename="' || myName || '"');
owa_util.http_header_close;
-- restitution du contenu...
for i in pdfDoc.first..pdfDoc.last loop
htp.prn(pdfDoc(i));
end loop;
elsif (myDest = 'S') then
--OWA_UTIL.MIME_HEADER('application/pdf');
OWA_UTIL.MIME_HEADER('text/html');
-- Return as a string
for i in pdfDoc.first..pdfDoc.last loop
htp.prn(replace(replace(replace(pdfDoc(i),'<', '<'),'>','>'),chr(10),'<br/>'));
end loop;
else
Error('Incorrect output destination: ' || myDest);
end if;
exception
when others then
error('Output : '||sqlerrm);
end Output;
Aguardo uma solução.
Att,
GAraujo.