Owa_util.listprint error
Hi,
I need a drop down list and am using this:
owa_util.listprint('SELECT mc_id FROM or_menlo_clients','p_clientid',1,FALSE);
but I'm getting this error:
ERROR at line 1:
ORA-01007: variable not in select list
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1147
ORA-06512: at "SYS.DBMS_SQL", line 339
ORA-06512: at "SYS.OWA_UTIL", line 1892
ORA-06512: at "SYS.OWA_UTIL", line 1908
I can't figure it out, the command is very simple.
Thanks!
Hi,
I wrote a test procedure in the portal schema and granted it to public:
create or replace procedure test
as
begin
htp.formOpen('testForm');
owa_util.listprint('select ename,empno,hiredate from scott.emp','col_combo',20);
htp.formClose;
end test;
Ran this from the browser :http://<hostname>:port/pls/dadname/portal30.test
It works fine.
You can see more about the same at :http://kontti.helsinki.fi:8889/ows-adoc/psqlwt12.htm
Thanks,
Anu
Similar Messages
-
Procedure trouble(owa_util.listPrint)
I'm trying to create some very basic "web" procedures and I'm now stuck on a problem.
create or replace procedure web_test2
as
begin
HTP.HTMLOPEN;
HTP.HEADOPEN;
HTP.TITLE('Webb Test');
HTP.HEADCLOSE;
HTP.BODYOPEN;
HTP.FORMOPEN( CURL => 'testschema.web_test2');
owa_util.listPrint('select namn from leverantor','v_ans',1,FALSE);
HTP.FORMSUBMIT('','Send','');
HTP.FORMCLOSE;
HTP.BODYCLOSE;
HTP.HTMLCLOSE;
END;
If I take away the line owa_util.listprint the procedure works fine. any idea on what the problem is?What is the error / message that you get ?In my web browser I get "The page cannot be found", but if I take away the owa_util from the procedure it works fine in the browser.
if i try to execute the procedure from sql*plus I get this error:
BEGIN web_test2; END;
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "SYS.OWA_UTIL", line 2074
ORA-06512: at "SYS.OWA_UTIL", line 2121
ORA-06512: at "ELBUTIK.WEB_TEST2", line 10
ORA-06512: at line 1
Why do you want to use the owa_util package ?can I dynamically create a list based on a table using HTP package?
if it works any tip on how to do it. -
Example of owa_util.listprint
can yoy help me and send me a owa_util.listprint's example.
thanks;Hi,
I wrote a test procedure in the portal schema and granted it to public:
create or replace procedure test
as
begin
htp.formOpen('testForm');
owa_util.listprint('select ename,empno,hiredate from scott.emp','col_combo',20);
htp.formClose;
end test;
Ran this from the browser :http://<hostname>:port/pls/dadname/portal30.test
It works fine.
You can see more about the same at :http://kontti.helsinki.fi:8889/ows-adoc/psqlwt12.htm
Thanks,
Anu -
Dear Oracle Guru's
I was going thru the documentation on OWA_UTIL and tried the examples given.
For an example , it suggested something like this
http://myhost:7777/pls/hr/showemps
in which showemps is the name of the function created using OWA_UTIL
when i used this url it gave the Page cannot be displayed error. I am unable to understand what pls , hr and myhost stands ....is it application server or database server ?
please help me
with warm regards
SaravHi,
I wrote a test procedure in the portal schema and granted it to public:
create or replace procedure test
as
begin
htp.formOpen('testForm');
owa_util.listprint('select ename,empno,hiredate from scott.emp','col_combo',20);
htp.formClose;
end test;
Ran this from the browser :http://<hostname>:port/pls/dadname/portal30.test
It works fine.
You can see more about the same at :http://kontti.helsinki.fi:8889/ows-adoc/psqlwt12.htm
Thanks,
Anu -
Ora-06502:pl/sql and ora-06512 at sys.owa_util errors
Greetings -
I have just installed APEX 2.2 in my 9.2.0.7 database and am going through the exercises in the "2 Day+ Application Express Developer's Guide." I was making good progress, until I got to Chapter 5, How to Control Form Layout. I created the script "ht_emp", as instructed. Everything in the script works, except for the "create or replace trigger bi_ht_emp" part. It fails with the following errors:
ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYS.OWA_UTIL", lone 328 ORA-06512: at "SYS.HTP", line 862 ORA-06512: at "SYS.HTP", line 977 ORA-06512: at "SYS.HTP", line 995 ORA-06512: at "FLOWS_020200.WWV_FLOW_SW_API", line 428 ORA-01003: no statement parsed. I have confirmed that nls_length_semantics = BYTE
Any suggestions?
Thanks in advance - GailScott -
Here's the part of the script that chokes --
CREATE OR REPLACE TRIGGER bi_ht_emp
BEFORE INSERT ON ht_emp
FOR EACH ROW
BEGIN
SELECT ht_emp_seq.nextval
INTO :new.emp_id
FROM DUAL;
:new.rec_create_date := SYSDATE;
END;
Thanks fro helping -
Gail -
Error while setting Owa_Util.Mime_Header
Hi.....
I have to make code to download BLOB file from my custom table Oracle APEX.
I am setting MIME Header using the following statement.
owa_util.mime_header(nvl( v_mime,'application/octet'), FALSE );
htp.p('Content-type: ' || v_mime);
htp.p('Content-length: ' || v_length);
htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
owa_util.http_header_close;
I am using this code to download BLOB file from table.
But i am getting following error:
Error report:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 354
ORA-06512: at "SYS.OWA_UTIL", line 413
ORA-06512: at line 10
06502. 00000 - "PL/SQL: numeric or value error%s"
Can anyone tell me how to come out of this error.
I am not able to understand this error.
Thanks in advance.
Edited by: user639262 on Sep 4, 2008 11:06 AMtward wrote:
I'm trying to use:
owa_util.mime_header('application/vnd.ms-excel', FALSE)
htp.p('Content-Disposition: filename="test.xls"');
owa_util.http_header_close;
htp.htmlopen;
htp.bodyopen;
htp.tableopen(cattributes=>'border="1" width="100%" align="CENTER"');
htp.tablerowopen;--(cattributes => 'align="LEFT", bgcolor="LIGHTGRAY"');
htp.tableheader(cattributes=>'width="10%"', cvalue => 'Header 1');
htp.tableheader(cattributes=>'width="15%"', cvalue => 'Header 2');
htp.tableheader(cattributes=>'width="20%"', cvalue => 'Header 3');
htp.tableheader(cattributes=>'width="10%"', cvalue => 'Header 4');
htp.tableheader(cattributes=>'width="20%"', cvalue => 'Header 5');
htp.tableheader(cattributes=>'width="25%"', cvalue => 'Header 6');
htp.tablerowclose;
htp.tableclose;
htp.bodyclose;
htp.htmlclose;
My understanding is that this will open the window to Open/Save/Cancel the output in Excel.....
But for some reason, it simply displays in a browser window.....
The first line in the windows is:
Content-type: application/vnd.ms-excel Content-Disposition: filename="test.xls"
followed by the HTML Table....
Why will it not open in Excel for me?Something is not getting recognized properly.
Try hard-coding the functionality you want into a static HTML document. Then work on using owa_util.mime_header or Like MichaelS suggested htp.p surrounded by any needed tags w/options to duplicate the working static document's functionality. -
APEX Listener 2.0.1
APEX 4.2.2
Oracle 11gR2
Linux RHEL 6.3
Glassfish 3.1.2
=============
After upgrading from APEX Listener 1.1.4 -> 2.0.1 the procedure owa_util.get_cgi_env( 'REMOTE_ADDR' ) fails to return the remote IP Address and instead I get the error
ORA-06502: PL/SQL: numeric or value error
Has something changed with the new APEX Listener 2.0.1? Is there a configuration element in the config or web.xml file that has to be changed before deploying the APEX Listener to GlassFish?
Thanks.Hi I cannot reproduce this issue, here's the test case I used, can you try this and report the output generated:
create or replace procedure test_cgi as
begin
owa_util.print_cgi_env;
htp.prn(owa_util.get_cgi_env( 'REMOTE_ADDR' ));
end;
grant execute on test_cgi to apex_public_user
Then I invoke the above procedure as follows:
http://localhost:8080/apex/<workspace-schema-name>.test_cgi
where <workspace-schema-name> is the database schema that the APEX workspace is using.
Which produces output like the following:
host = localhost:8080
user-agent = Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/17.0 Firefox/17.0
accept = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
accept-language = en-US,en;q=0.5
accept-encoding = gzip, deflate
dnt = 1
connection = keep-alive
cookie = ORA_WWV_REMEMBER_UN=RESTEASY_ADMIN:resteasy; ORA_WWV_USER_61813546913094=461E06966F3D10A956FC84806D0CFF22
APEX_LISTENER_VERSION = 2.0.3.199.09.35
DAD_NAME =
DOC_ACCESS_PATH =
DOCUMENT_TABLE =
GATEWAY_IVERSION = 3
GATEWAY_INTERFACE = CGI/1.1
HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING = gzip, deflate
HTTP_ACCEPT_LANGUAGE = en-US,en;q=0.5
HTTP_ACCEPT_CHARSET =
HTTP_IF_MODIFIED_SINCE =
HTTP_IF_NONE_MATCH =
HTTP_HOST = localhost:8080
HTTP_ORACLE_ECID =
HTTP_PORT = 8080
HTTP_REFERER =
HTTP_USER_AGENT = Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/17.0 Firefox/17.0
PATH_ALIAS =
PATH_INFO = /resteasy.test_cgi
PLSQL_GATEWAY = WebDb
QUERY_STRING =
REMOTE_ADDR = 0:0:0:0:0:0:0:1
REMOTE_USER = apex
REQUEST_CHARSET = AL32UTF8
REQUEST_IANA_CHARSET = UTF-8
REQUEST_METHOD = GET
REQUEST_PROTOCOL = http
REQUEST_SCHEME = http
SCRIPT_NAME = /apex
SCRIPT_PREFIX =
SERVER_NAME = localhost
SERVER_PORT = 8080
SERVER_PROTOCOL = HTTP/1.1
SERVER_SOFTWARE = Mod-Apex
WEB_AUTHENT_PREFIX =
HTTP_COOKIE = ORA_WWV_REMEMBER_UN=RESTEASY_ADMIN:resteasy; ORA_WWV_USER_61813546913094=461E06966F3D10A956FC84806D0CFF22
0:0:0:0:0:0:0:1 -
Unable to run procedure due to error in package OWA_UTIL
Hi,
I have written a nice PL/SQL procedure called 'send_notification'.. My procedure begins like this :
create or replace
procedure send_notification
is
ws_id number;
l_body clob;
l_url varchar2(256);
l_cgi_var_name varchar2(100) default 'SERVER_NAME';
l_server_name varchar2(2000) ;
begin
l_server_name := owa_util.get_cgi_env(l_cgi_var_name) ;
The procedure is nicely compiled without errors. When I run the procedure "send_notification", I get these error messages :
ORA-06502: PL/SQL : erreur numérique ou erreur sur une valeur
ORA-06512: à "SYS.OWA_UTIL", ligne 356
ORA-06512: à "SIVOA.SEND_NOTIFICATION", ligne 10
ORA-06512: à ligne 2
The lines 354-356 of the package OWA.UTIL shows this :
function get_cgi_env(param_name in varchar2) return varchar2 is
upper_param_name varchar2(2000) := upper(param_name);
begin
I have successfully compiled the package OWA_UTIL.
Thank you for your kind help.
ChristianThierry,
Your solution is working nicely.
create or replace
procedure send_notification
is
ws_id number;
l_body clob;
l_url varchar2(256);
l_cgi_var_name varchar2(100) default 'SERVER_NAME';
l_server_name varchar2(2000) ;
nm owa.vc_arr;
vl owa.vc_arr;
begin
nm(1) := 'X';
vl(1) := 'Y';
owa.init_cgi_env( nm.count, nm, vl );
l_server_name := owa_util.get_cgi_env(l_cgi_var_name) ;
select max(workspace_id) into ws_id from apex_applications ;
wwv_flow_api.set_security_group_id(ws_id);
FOR C1 IN ( SELECT id, email, nature_contrat
from contrats_maintenance
where email is not null
and alert = 1
and DATE_ENVOI_PROCHAIN_MAIL <= SYSDATE
and (email_sended IS NULL OR email_sended = 0)
loop
l_url := 'http://'||l_server_name||':7777/pls/apex/f?p=109:29:::NO::P29_ID:'||C1.ID ;
l_body := l_body ||chr(13)||'Bonjour,'||chr(13)||chr(13);
l_body := l_body ||chr(13)||'Un contrat de maintenance arrivera à échéance -> '||l_url;
l_body := l_body ||chr(13)||'Cliquez sur le lien pour y accéder.';
l_body := l_body ||chr(13)||'Cordialement.'||chr(13)||chr(13);
l_body := l_body ||chr(13)||'Le robot Oracle.';
APEX_MAIL.SEND(
P_TO => c1.email,
P_FROM => '[email protected]',
P_BODY => l_body,
P_SUBJ => 'Notification d''échéance d''un contrat de maintenance : '|| c1.Nature_contrat );
APEX_MAIL.PUSH_QUEUE;
update contrats_maintenance
set email_sended = 1, email_send_date = sysdate
where ID = C1.ID;
end loop;
end send_notification;Thank you very much !
Edited by: Christian on Jan 19, 2011 2:51 AM -
Was working on tutorial from the:
Oracle Database Express Edition 2 Day Plus Application Express Developer Guide
Working on the section 4: How to Control Form Layout.
Ran into a problem trying to compile the Create HT-EMP Table script.
keep getting this error for this particular segment creating the bu_ht_emp trigger:
pp. 4-2 and 4-3
CREATE OR REPLACE TRIGGER bi_ht_emp
BEFORE INSERT ON ht_emp
FOR EACH ROW
BEGIN
SELECT ht_emp_seq.nextval
INTO :new.emp_id
FROM DUAL;
:new.rec_create_date := SYSDATE;
END;
ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYS.OWA_UTIL", line 354....etc
I've check the syntax for the entire script and it all checks out. Does anyone have a clue why this is failing?If I'm looking at the same DDL, not seeing where it would throw an owa_util error, are you running it in the apex script editor?
Just plain sqlplus doesn't like the empty line stuck in with the list of check constraints on the emp_dept column, after fixing that up (and dropping the sequence that got created on the first pass) the DDL and insert runs fine- -
SYS.OWA_UTIL error
Hi all,
I am trying to run a report from Oracle application server and I am receiving the following error. The reports can be accessed from the web and a .Net web application. The reports run without any error when invoked from the web but raise the following error when invoked from the .Net app. I read in one of the posts that we cannot call OWA_UTIL package from a non web environment. Can you please advise how to avoid this issue.
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 328
ORA-06512: at "SYS.OWA_UTIL", line 2172
ORA-06512: at "XXXXXXXXXXXXXXXXXXX", line 383
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 328
ORA-06512: at "SYS.OWA_UTIL", line 2172
ORA-06512: at "XXXXXXXXXXXXXXXXXXX", line 343
ORA-02068: following severe error from IASDB
ORA-03113: end-of-file on communication channel
ORA-02068: following severe error from IASDB
ORA-03113: end-of-file on communi
I really appreciate your time and effort. Thanks.Hello Michael,
Thanks for the quick reply. I am just curious to know that difference between the following.
In one of your earlier posting you mentioned that we can initialize using
Declare
name_arr OWA.VC_ARR;
value_arr OWA.VC_ARR;
BEGIN
begin
if owa.num_cgi_vars is null
then
OWA.INIT_CGI_ENV(0, NAME_ARR, VALUE_ARR);
end if;
end;
In the current post you are referring to
declare
param_val owa.vc_arr;
begin
param_val (1) := 1;
owa.init_cgi_env (param_val);
htp.p ('Some Text');
htp.showpage ();
end;
Does it matter which procedure I call? -
Error - ORA-06512: at "SYS.OWA_UTIL" - when trying to download files.
Hi, I have an application where I try to implement download of the attachments.
I am trying to use Denes Kubicek approach
http://apex.oracle.com/pls/otn/f?p=31517:15:4179200867819025:REMOVE_ID:NO::P15_DELETE_ID:4672033519340628563.
When I run stored procedure I get this error message.
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.OWA_UTIL", line 413
ORA-06512: at "RPA.LOADATTACHMENT", line 24
ORA-06512: at line 6
The code breaks at :
OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);
Does anybody have any idea why it breaks?
Thanks in advance.
Robert
Edited by: robik on 2-Feb-2011 5:58 AMActually, the error comes up when I try to execute any of these lines:
OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);
-- set the size so the browser knows how much to download
HTP.p ('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
HTP.p ( 'Content-Disposition: attachment; filename="'
|| REPLACE (REPLACE (SUBSTR (v_file_name,
INSTR (v_file_name, '/') + 1
CHR (10),
NULL
CHR (13),
NULL
|| '"'
Is there any security issue?
Robert -
OWA_UTIL and HTP across database link
Has anyone figured out how to use the features of OWA_UTIL, such as listprint, across a database link? I can create a drop list on data that is in the portal instance. But if I try to create a list based on a table in a back-end database through a database link, it generates errors.
Also, I create a procedure to generate a dynamic page portlet using htp calls and it works fine if the procedure is located in the portal instance. But move the code to the back-end database and access via a synonym and database link and it generates errors out of the owa_util package.Create a view on your local db using tables over the db link and base your list on that view.
-
Error While loading a image from database
Purpose
Error While loading the Image from the database
ORA-06502: PL/SQL : numeric or value error:Character string buffer too small
ORA-06512: at "Sys.HTP" ,line 1480
Requirement:
I am developing the web pages using PSP(Pl/sql Serverpages) . I have a requirement to show a image in the webpage. I got the following procedures from the oracle website.
I have created the following table to store the images
create table DEMO
ID INTEGER not null,
THEBLOB BLOB
And I also uploaded the Images. Now I am try to get a image from the table using the following procedure .But I am getting the error message line 25( htp.prn( utl_raw.cast_to_varchar2( l_raw ) );) .at it throws the following error messages
ORA-06502: PL/SQL : numeric or value error:Character string buffer too small
ORA-06512: at "Sys.HTP" ,line 1480
Procedure that I used to get the image
create or replace package body image_get
as
procedure gif( p_id in demo.id%type )
is
l_lob blob;
l_amt number default 30;
l_off number default 1;
l_raw raw(4096);
begin
select theBlob into l_lob
from demo
where id = p_id;
-- make sure to change this for your type!
owa_util.mime_header( 'image/gif' );
begin
loop
dbms_lob.read( l_lob, l_amt, l_off, l_raw );
-- it is vital to use htp.PRN to avoid
-- spurious line feeds getting added to your
-- document
htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
l_off := l_off+l_amt;
l_amt := 4096;
end loop;
exception
when no_data_found then
NULL;
end;
end;
end;
What I have to do to correct this problem. This demo procedure and table that I am downloaded from oracle. Some where I made a mistake. any help??
Thanks,
NatsHi Satish,
I have set the raw value as 3600 but still its gives the same error only. When I debug the procedure its throwing the error stack in
SYS.htp.prn procedure of the following line of code
if (rows_in < pack_after) then
while ((len - loc) >= HTBUF_LEN)
loop
rows_in := rows_in + 1;
htbuf(rows_in) := substr(cbuf, loc + 1, HTBUF_LEN);
loc := loc + HTBUF_LEN;
end loop;
if (loc < len)
then
rows_in := rows_in + 1;
htbuf(rows_in) := substr(cbuf, loc + 1);
end if;
return;
end if;
Its a system procedure. I don't no how to proceed .. I am really stucked on this....is their any other method to take picture from the database and displayed in the web page.....???? any idea..../suggesstion??
Thanks for your help!!!. -
Error while downloading a file via APEX screen
While I try to download a file using the below code;
an HTTP 404 error is coming although the proc is being called and the parameter is correctly being passed.
Please help.
create or replace procedure download_myfile1(p_id in number)
as
v_mime varchar2(255);
v_length number;
v_file_name varchar2(2000);
Lob_loc BLOB;
BEGIN
-- -- Selecting the details from the table whoch contains the extracts
select EXTRACT_FILE,FILE_NAME,dbms_lob.getlength(EXTRACT_FILE) into lob_loc,v_file_name,v_length from table_name where ID = p_id;
-- -- set up HTTP header
-- -- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from windows
owa_util.mime_header( 'application/octet', FALSE );
-- set the size so the browser knows how much to download
--v_file_name := substr(v_file_name,1,instr(v_file_name,'.')-1);
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment; filename="'||v_file_name|| '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( lob_loc );
end download_myfile1;
It shows a POP up window by which u can save or opens the file. But no pop up displayed in this case.
-ShreyaHi,
Made the same changes but still getting the same error.
The earlier URL also that I had mentoned would dynamically make this url mentioned by you and then shows the pop up window.
However when I am right clicking on the download link and then clicking 'Save target as' then this error message is provided:
Internet Cannot download [schema name].download_myfile2 from [DNS name]
Internet Explorer was not able to open this Internet Site.The requested site is either unavailable or cannot be found .Please try again.
Please help..
Thanks in Advance ...
Shreya
Edited by: 935203 on Jul 9, 2012 11:58 PM -
A question about error with jasperserver for pdf and Apex
I have created a pdf report on jasperserver and I can call it from apex via a url and it displays fine. The url is this format {http://server:port/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Apex/deptemp&output=pdf&deptNo=#DEPTNO#&j_username=un&j_password=pw}
However, I am trying to follow a stored procedure executed from Apex so it would not expose the username/pwd in the url like above.
If I am reading the apache error log correctly it is erroring in this piece of the code below where it executes {Dbms_Lob.writeAppend}
loop
begin
-- read the next chunk of binary data
Utl_Http.read_raw(vResponse, vData);
-- append it to our blob for the pdf file
Dbms_Lob.writeAppend
( lob_loc => vBlobRef
, amount => Utl_Raw.length(vData)
, buffer => vData
exception when utl_http.end_of_body then
exit; -- exit loop
end;
end loop;
Utl_Http.end_response(vResponse);}
The error log says this; HTTP-500 ORA-14453: attempt to use a LOB of a temporary table, whose data has alreadybeen purged\n
What is this error telling me and how can I correct it?
The stored procedure I am following is below but replaced the vReportURL with my url like above that works.
Thank you,
Mark
{CREATE OR REPLACE procedure runJasperReport(i_deptno in varchar2)
is
vReportURL varchar2(255);
vBlobRef blob;
vRequest Utl_Http.req;
vResponse Utl_Http.resp;
vData raw(32767);
begin
-- build URL to call the report
vReportURL := 'http://host:port/jasperserver/flow.html?_flowId=viewReportFlow'||
'&reportUnit=/reports/Apex/deptemp'||
'&output=pdf'||
'&j_username=un&j_password=pw'||
'&deptNo='||i_deptno;
-- get the blob reference
insert into demo_pdf (pdf_report)
values( empty_blob() )
returning pdf_report into vBlobRef;
-- Get the pdf file from JasperServer by simulating a report call from the browser
vRequest := Utl_Http.begin_request(vReportUrl);
Utl_Http.set_header(vRequest, 'User-Agent', 'Mozilla/4.0');
vResponse := Utl_Http.get_response(vRequest);
loop
begin
-- read the next chunk of binary data
Utl_Http.read_raw(vResponse, vData);
-- append it to our blob for the pdf file
Dbms_Lob.writeAppend
( lob_loc => vBlobRef
, amount => Utl_Raw.length(vData)
, buffer => vData
exception when utl_http.end_of_body then
exit; -- exit loop
end;
end loop;
Utl_Http.end_response(vResponse);
owa_util.mime_header('application/pdf',false);
htp.p('Content-length: ' || dbms_lob.getlength(vBlobRef));
owa_util.http_header_close;
wpg_docload.download_file(vBlobRef);
end runJasperReport;
/}I am new to working with working with jasperserver to apex interfacing, and also using utl_http with binary data.
But I guess typing my question down helped me figure out a way to make it work for me.
I combined info from http://www.oracle-base.com/articles/misc/RetrievingHTMLandBinariesIntoTablesOverHTTP.php
and from http://sqlcur.blogspot.com/2009_02_01_archive.html
to come up with this procedure.
{create or replace PROCEDURE download_file (p_url IN VARCHAR2) AS
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
l_blob BLOB;
l_raw RAW(32767);
BEGIN
-- Initialize the BLOB.
DBMS_LOB.createtemporary(l_blob, FALSE);
-- Make a HTTP request, like a browser had called it, and get the response
l_http_request := UTL_HTTP.begin_request(p_url);
Utl_Http.set_header(l_http_request, 'User-Agent', 'Mozilla/4.0');
l_http_response := UTL_HTTP.get_response(l_http_request);
-- Copy the response into the BLOB.
BEGIN
LOOP
UTL_HTTP.read_raw(l_http_response, l_raw, 32767);
DBMS_LOB.writeappend (l_blob, UTL_RAW.length(l_raw), l_raw);
END LOOP;
EXCEPTION
WHEN UTL_HTTP.end_of_body THEN
UTL_HTTP.end_response(l_http_response);
END;
-- make it display in apex
owa_util.mime_header('application/pdf',false);
htp.p('Content-length: ' || dbms_lob.getlength(l_blob));
owa_util.http_header_close;
wpg_docload.download_file(l_blob);
-- Release the resources associated with the temporary LOB.
DBMS_LOB.freetemporary(l_blob);
EXCEPTION
WHEN OTHERS THEN
UTL_HTTP.end_response(l_http_response);
DBMS_LOB.freetemporary(l_blob);
RAISE;
END download_file; }
Don;t know what I did wrong, but I could not create an 'on-demand' process to call my procedure. I did not understand what it means when it says 'To create an on-demand page process, at least one application level process must be created with the type 'ON-DEMAND'.
so I had to use a blank page with a call to my procedure in the onload - before header process and that seems to work ok.
Thank you,
Mark
Maybe you are looking for
-
FM or table to check whether a transaction is locked or not
Hi all. I need to create change a return order (VA02 Transaction ) & then need to create a delivery (VL01N Transaction) for this return order no. My issue is before creating delivery (VL01n) I need to check whether return order (VA02) is lock
-
Problem with HP 6500-E709n Wireless software on Windows 7 64-bit
How do I, or should I, uninstall Microsoft xps printer before installing HP 6500-E709n software on Windows 7 64-bit? I have tried installing, uninstalling & reinstalling the software twice now and am preparing for a third installation. I inadvertentl
-
How to read complete line displayed thru ALV report on double click? urgent
Hi guys, An ALV report is displayed using 'REUSE_ALV_LIST_DISPLAY' and i have a requirement such that i have to read the line item on which double click is done. I have to fetch the line item, field by field and not by characters. I have attached the
-
How to call a form by JfPreamble
Hello, can i call a form with JfPreamble without call through files.dat I had inserted ^form module name.mdf in the jfPreamble but when i launch the test for presentment appear an error : Error '-14' from print module. Make sure the 'Output to' or 'P
-
Problem: I was thinking I could free up space on my external hardrive by dumping into the trash my oldest Time Machine back up dates. What has happened is that the oldest files are indeed lost from my computer. Bad Logic: I assumed the most current d