Unable to use WPG_DOCLOAD.download_file in Apex 4.2.1
Hi guys,
I stumbled on the next problem. We recently migrated from apex 4.0 to 4.2.1 and use a procedure to open an RTF document filled with parameters from a chosen record.
It always worked with the a procedure calling the next line: WPG_DOCLOAD.download_file (l_doc);
Now, in 4.2.1 it doesn't do anything, doesn't give an error if a press the button.
Has anyone experienced the same problem? I already searched the internet but never found a solution.
Thanks in advance.
thanks for your fast answer. The issue is with a migrated application.
And here is snippet of my package code:
l_filename := r_brief.template_naam;
l_mime_type := r_brief.template_mime;
v_document_clob := GEN$PL_UTILS.blob_to_clob(r_brief.template_blob);
v_document_clob := GEN$PL_UTILS.replace_tags_in_clob(v_document_clob , tab_temp_tags_values, tab_temp_toegelaten_tags, v_replace_error);
l_doc := GEN$PL_UTILS.clob_to_blob(v_document_clob);
l_length := DBMS_LOB.getlength(l_doc);
OWA_UTIL.mime_header (l_mime_type);
HTP.p ('Content-length: ' || l_length);
HTP.p ('Content-Disposition: attachment; filename="'||REPLACE(REPLACE(SUBSTR(l_filename,INSTR(l_filename,'/')+1),CHR(10),NULL),CHR(13),NULL)||'"');
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (l_doc);
Do you see something wrong here?
Similar Messages
-
Unable to correctly download Document using wpg_docload.download_file.
I am using default MOD/PLSQL Portal Functionality to Upload the files into the Portal. I am able to download the documents uploaded by me, but I am unable to view the documents uploaded by others
I have used the following procedure for download. Is there something severly wrong.
I need some urgent help to save my neck
Create or replace Procedure downloadfile
V_FILEID IN VARCHAR2)
as
begin
wpg_docload.download_file(v_fileid);
exception
when others then
htp.p(sqlerrm);
end;helo there.
I TRIED THE SAME BUT I DIDN'T SUCCEED.. SINCE MY SYSTEM CACHING HAD A PROBLEM.
ANY SUGGESTIONS ARE HIGHLY APPRICIATED.
BYE -
Problem when downloading file to local using WPG_DOCLOAD.download_file
Hi ,
i am using database 11g and i am trying to write to file on database server using utl_file and download to the local machine by pl/sql procedure . i am directly executing this procedure in pl/sql . i am getting ORA-06502: PL/SQL: numeric or value error when executing owa_util.mime_header ('application/vnd.ms-excel',TRUE); statement in the procedure . not sure what is happening and i am new in using these features
here is my code
CREATE OR REPLACE PROCEDURE UTL_TEST_DOWNLOAD
AS
output_file utl_file.file_type;
vexists BOOLEAN;
vfile_length NUMBER;
vblocksize NUMBER;
l_blob BLOB;
l_bfile BFILE;
BEGIN
output_file:=UTL_FILE.FOPEN('DATA_DIR', 'timesheet.csv', 'w');
UTL_FILE.PUT_LINE(output_file,'COST_CENTRE'||
'HISTORY_DATE'||
'REF_NO'||
'FIELD_NAME'||
'VALUE'||
'DATA_TYPE'||
'CHANGE_DATE'||
'INT_REF');
UTL_FILE.fclose(output_file);
UTL_FILE.FGETATTR('DATA_DIR','timesheet.csv',vexists,vfile_length,vblocksize);
IF vexists THEN
DBMS_LOB.createtemporary (l_blob, TRUE, DBMS_LOB.SESSION);
l_bfile := BFILENAME ('DATA_DIR', 'timesheet.csv');
DBMS_LOB.fileopen (l_bfile,dbms_lob.file_readonly);
DBMS_LOB.loadfromfile (l_blob, l_bfile, DBMS_LOB.getlength (l_bfile));
DBMS_LOB.fileclose (l_bfile);
owa_util.mime_header ('application/vnd.ms-excel',TRUE);
dbms_output.put_line('after owa_util' );
owa_util.http_header_close;
WPG_DOCLOAD.download_file (l_blob);
end if;
EXCEPTION
WHEN utl_file.invalid_path THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_path');
WHEN utl_file.invalid_mode THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_mode');
WHEN utl_file.invalid_filehandle THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_filehandle');
WHEN utl_file.invalid_operation THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_operation');
WHEN utl_file.read_error THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.read_error');
WHEN utl_file.write_error THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.write_error');
WHEN utl_file.internal_error THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.internal_error');
WHEN OTHERS THEN
dbms_output.put_line('SQLERRM '||SQLERRM);
END UTL_TEST_DOWNLOAD
SQLERRM ORA-06502: PL/SQL: numeric or value error
The file is getting created all the time i execute this procedure i am getting the above error while executing this statement owa_util.mime_header ('application/vnd.ms-excel',TRUE);
Edited by: user5784286 on Jul 2, 2012 7:35 PMHi,
You need to call the procedure owa.init_cgi_env before you can use owa_util.mime_header from SQL*Plus.
See [url http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:500221786045]here for details.
Rod West -
How can I use wpg_docload.download_file and prompt the user to save it?
Hi,
Posted about this a couple of weeks ago with a text file and got the following code (where x.zip=x.txt) and it worked fine. Problem is that I need to do this with zip files, and when I run the code below, it simply displays the zip file, rather than prompting the user to save the file. Have tried every mime type under the sun. No joy.
The How to Upload and Download Files in an Application Advanced Tutorial for Release 3.2 does not work for APEX4. Simply creating a file browse item leads to Error ORA-20999: P3_FILE_NAME has to have a valid BLOB column as source. and so I cannot follow that tutorial to get further clues on how to make this work.
Susan
Thanks and here's the wpg_docload.download_file code that displays a binary file:
declare
lob_loc bfile;
v_length integer;
fname varchar2(100) := 'x.zip';
l_blob blob;
des_offset number := 1;
src_offset number := 1;
begin
lob_loc := bfilename('CELFILES_9906', fname);
v_length := dbms_lob.getlength(lob_loc);
DBMS_LOB.createtemporary(l_blob, FALSE);
dbms_lob.open(lob_loc, dbms_lob.lob_readonly);
DBMS_LOB.LOADBLOBFROMFILE(
dest_lob=>l_blob,
src_bfile=>lob_loc,
amount=>v_length,
dest_offset=>des_offset,
src_offset=>src_offset);
owa_util.mime_header('application/zip', false);
htp.p('Content-length: ' || v_length);
htp.p('Content-Disposition: inline; filename="' || fname || '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( l_blob );
DBMS_LOB.freetemporary(l_blob);
EXCEPTION WHEN OTHERS THEN
DBMS_LOB.freetemporary(l_blob);
RAISE;
end;I downlod blobs like this without issue (using IE7 and FF):
owa_util.mime_header('application/octet', False);
HTP.p ('Content-length: ' || DBMS_LOB.getlength (l_blob));
htp.p('Content-Disposition: attachment; filename="'||v('P20_FNAME')||'"');
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (l_blob);
...Remember, that it's your browser's MIME type settings that determine whether to pop up a save diaglog box. In FF 3.6 > Tools > Options > Applications > Content type. The set action for each mime type. -
Wpg_docload.download_file slow (or has a memory leak)
Hi, (Maybe this should be in the pl/sql forum, but since this is so much used in Apex and I ran into this problem there, I decided to post it here).
There seems to be a memory leak or some other issue with using wpg_docload.download_file
I have a couple of pages that show many images (50+, icon sized) . And usually a few days after restarting the Oracle http server, I see the image rendering becoming extremely slow (and usually most images timing out.)
So in all my procedures using :
wpg_docload.download_file ( lob_loc );
I switched it out for :
declare
buffer raw ( 32000 );
buffer_size integer := 32000;
offset integer := 1;
begin
while offset < v_length loop
dbms_lob.read ( lob_loc, buffer_size, offset, buffer );
htp.prn ( utl_raw.cast_to_varchar2 ( buffer ) );
offset := offset + buffer_size;
end loop;
end;
And the speed increase in image loading was phenomenal, I am looking at over 10x speed recieving the image data from the webserver.
Is there a known bug with wpg_docload.download_file in 10.2.0.2?
But anyways, if anybody else is running into this slowness, then by all means, try out this workaround.
Regards
Oli
edit:
There seems to be one other thing that matters in the resulting speed of the image retrieval. I used mod_rewrite to make the images look like /icon/1235.jpg
and after further testing, this seems to be the catalyst for image retrieval. Not the wpg_docload.download_file
Message was edited by:
OliOli,
Image retrieval for something.jpg is faster then proc?id=1234That fits in with my theory, browsers often will not rely on a cached version for a URL that contains a parameter (after all, how would the browser know whether the URL is going to return the same data or not even if the parameter is the same?). When you request a particular file (i.e. something.jpg then the browser can use the cache since you have requested a particular file, as opposed to calling a 'procedure/function'.
This is definetly a browser issue, and it has nothing to do with cacheYou browser has a cache and can use it if it wishes to, so I would still suspect it is related to caching (or lack of caching).
I would suggest producing the smallest possible test case you can so that the behaviour you describe can be demonstrated. -
I am using the standard wpg_docload.download_file ( l_blob ) to download individual files in APEX.
However I also need an Archive function to pull out multiple blob records each time from the Oracle database and I do not want to select "save as" each time for each file. As this is the case then I cannot use
wpg_docload.download_file( l_blob )
Is there an alternative command I can use to export multiple blob files from oracle to a specific folder on the network
Thanks
StephenStephen:
if you ever figure out how to do this, please make sure you post the solution on this forum. We have the same requirement, to be used for 2 scenarios: one for archiving old documents, and the other for downloading a bunch of files based on the report search criteria (e.g. download me all policy documents issued in 2007 calendar year, download all certificates issued in county XYZ, etc).
Vojin -
Wpg_docload.download_file hangs
Hi all!
I have question about file download using wpg_docload.download_file.
That looks like that my plsql code hangs on this. It depends on size of blob data what i'm trying download. Also it happens only on one of three servers we have. (All of them are Oracle 10g).
If anyone have had similar problem pls... answer!
Best regards!
JaanHello Peter,
I'm not sure whether this is a listener related problem, but we should try to find out.
I have examples where a temporary blob is created first before the content is passed to WPG_DOCLOAD, which produce a working download on the APEX Listener.
So I don't think the problem concerns WPG_DOCLOAD but the way you handle your blob, or to be precise, your BFILE.
What comes to my mind first: Don't you need to open that file? When I use DMBS_LOB.LOADBLOBFROMFILE, I guess this is done somewhere inside that routine, but for other kinds of bfile access, there is DBMS_LOB.FILEOPEN.
When thinking of that part: If I'm not completely wrong, there is a difference in which db user is acutally executing, or in other words, on whose behalf your code is executed, when you create a temporary blob first and forward it to wpg_docload or have wpg_docload do the file access. The Null Pointer Exception may result from either the file not being existent or not accessible for the db user executing the code. In case of wpg_docload accessing the file, perhaps the user you configured your APEX Listener to connect with needs additional grants for that file access.
Just a thought. It should be easy to test the same scenario with using a temporary file on APEX Listener to see if that works and start debugging from there.
-Udo -
Wpg_docload.download_file opens in a new window in PL/SQL Oracle code
I am trying to download the attachment from web browser using wpg_docload.download_file command from the PL/SQL procedure. I like to open the document in the same browser window instead of opening new window (Excel spreadsheet opens in Excel) or when the new window opens, the old window should close.
Does anybody know how to do thisHi,
Rather than submitting the page I would try opening a new page (for example, by calling popUpNamed) passing the ids as a parameter to this page. Then have your download process as a before header process on this page.
Use apex_application.g_unrecoverable_error := TRUE; at the end of your code to ensure that none of the page processing for this page is actually run.
Rod West -
Wpg_docload.download_file
Hi,
I've IAS 10G release2 on windows 2003 server,
Database 10G on windows 2003 server,
Http server-->mod_plsql services-->DAD
I used wpg_docload.download_file() in procudure to download file pdf from blob column,
If I download in internal network, It's successful
but if I downloaded from external network with dial 56k or isdn 256K
sometime successful with file size 1Mb /sometime error occured with
file size 100 Kb with message: internet explorer cannot download file from server
the connection with the server was reset
please help,
TaiyuthHi Taiyuth,
It's probably due to the directive TimeOut in your Apache configuration.
By default, in the httpd.conf configured by Oracle,TimeOut = 300 (300 seconds i.e. 5 minutes)
If your download spent a time > 5 min the connection is reset by the Apache Server
So increase the value of TimeOut directive in your httpd.conf
and il will probably solve your problem.
Mike -
WPG_DOCLOAD.download_file - can I download a BFILE directly?
In the past I've been using WPG_DOCLOAD.download_file to download blobs with little problem other than it can be v slow as the files in our application are stored as BFILES on a file server and the application takes time in pulling the file across and creating a temp_blob in the database, which is then presented to the user for download (the files can be v large)
The link below suggests that I can pass through a BFILE directly to the WPG_DOCLOAD.download_file procedure, however I cannot modify my code to get it to work
Download BFILE Procedure
The simple code I have is below - and is called by an application process. The code runs but the downloaded file is empty.
DECLARE
v_mime VARCHAR2(48) := NULL;
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BFILE;
BEGIN
SELECT path, name, DBMS_LOB.GETLENGTH(path)
INTO lob_loc,v_file_name,v_length
FROM temp_tars
WHERE tarid = v('P1_TARID');
DBMS_LOB.OPEN(lob_loc, DBMS_LOB.LOB_READONLY);
OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);
HTP.p ('Content-length: ' || v_length);
HTP.p ( 'Content-Disposition: attachment; filename="' || v_file_name || "');
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (lob_loc);
DBMS_LOB.CLOSE(lob_loc);
end;Hi,
You have grant all needed privileges, e.g. read permission to DAD user to your directory ?
Regards,
Jari
Edited by: jarola on Jan 5, 2011 1:59 PM
Here is similar post that might help
Re: Simple way to display pictures stored outside oracle xe in a html region -
Wpg_docload from inside apex
- I would like to use the below procedure to download an image in a new browser window.
- I created a public dad
- I created the following package/procedure:
create or replace package body jmf as
procedure download
is
v_bfile bfile;
begin
select bfilename('MY_FILES', 'jmf.pdf')
into v_bfile
from dual;
owa_util.mime_header('application/pdf', false);
owa_util.http_header_close;
wpg_docload.download_file(v_bfile);
end download;
end jmf;
- I am able to call this procedure from the url and it downloads the PDF
- I want to call this procedure from a APEX before header process. When I do I get the follwing error:
Apex error returned:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Apache Error_log :
(note: pyro is the dad apex is using)
error: mod_plsql: /pyro/f http-500 ora22285: non-existent directory or file for GETLENGTH operation\n
alert: unable to reset state for mode 0: Err 22285 url=>/pyro/F
Any Ideas would be greatly appreciated.
Thanks
JonJon,
Take a look at the function download_file, which should install as part of the Sample Application. You can use something like that to download a file via an APEX process.
Here's a copy of that function, or at lease one that's similar:
create or replace procedure download_file
(p_ticket_file_id in number)
as
l_mime_type varchar2(255);
l_length number;
l_content_file_name varchar2(2000);
l_content_file blob;
begin
select
mime_type,
content_file,
file_name,
dbms_lob.getlength(content_file)
into
l_mime_type,
l_content_file,
l_content_file_name,
l_length
from
ticket_files
where
ticket_file_id = p_ticket_file_id;
owa_util.mime_header(nvl(l_mime_type,'application/octet'), FALSE );
htp.p('Content-length: ' || l_length);
htp.p('Content-Disposition: filename="' || l_content_file_name || '"');
owa_util.http_header_close;
wpg_docload.download_file(l_content_file);
end download_file;
/ -
Internal server error after wpg_docload.download_file
Hello,[PRE]
In apex v. 2.1 after running this procedure:
create or replace procedure download_my_file(cislo_prilohy In Number) As
v_length Number;
v_file_name Varchar2(2000);
Lob_loc Bfile;
Begin
Select filename
Into v_file_name
From PRIL
Where cisloprilohy = cislo_prilohy;
Lob_loc := bfilename('PRILOHY', v_file_name);]
v_length := dbms_lob.getlength(Lob_loc);]
owa_util.mime_header('application/octet', False);]
htp.p('Content-length: ' || v_length);]
htp.p('Content-Disposition: attachment; filename="' || SUBSTR(v_file_name, INSTR(v_file_name, '/') + 1) || '"');
owa_util.http_header_close;]
wpg_docload.download_file(Lob_loc);]
End download_my_file;]
I got window "Download file" with correct filename and size,but after I saved or opened the file, there was only:
HTTP/1.1 500 Internal Server Error
Server: Oracle XML DB/Oracle Database
Content-Type: application/octet
Content-Length: 4056367
Content-Disposition: attachment; filename="nikon.pdf"
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>500 Internal Server Error</TITLE>
</HEAD><BODY><H1>Internal Server Error</H1>
</BODY></HTML>
inside the file.
Here are my steps:
1) I created directory object 'PRILOHY' and granted read permissions on them.
2) I created table PRIL (CISLOPRILOHY NUMBER,FLOB BFILE,FILENAME Varchar2, CISLOPASPORTU NUMBER)
3) I inserted row into the table:
insert into PRIL (FLOB,FILENAME,CISLOPASPORTU)
values (BFILENAME('PRILOHY','nikon.pdf'),'nikon.pdf',201);
4) I created procedure download_my_file.
5) I run procedure from apex process.
Any ideas, what's wrong?
Thank you
ZdenekUnfortunatelly it did'nt help.[PRE] I've tried use only this code as a database user from APEX:
Lob_loc := bfilename('PRILOHY', v_file_name);
wpg_docload.download_file(Lob_loc);
with the same error.
Thanks for help. -
Trouble with wpg_docload.download_file - Donwload Files - Oracle Web App
i appreciate too much for everyone who can help me.
I've got a ERROR with my Oracle Web App. When i type the URL "http://mydomain.com/pls/docs" in my browser, got this error:
--------------------------------BROWSER-----------------------------------------
Estado de Descarga
Descarga del archivo falló. ORA-01403: no data found. ORA-01403: no data found
And the code that generates this error is:
PROCEDURE LEP_DESCARGA_ARCHIVO IS
lv_FilePath VARCHAR2(32000); lv_FileName VARCHAR2(32000);
BEGIN
lv_FilePath := SUBSTR(owa_util.get_cgi_env('PATH_INFO'),2);
SELECT name INTO lv_FileName FROM table_file WHERE UPPER(name) like UPPER(lv_FilePath); wpg_docload.download_file(lv_FileName);
EXCEPTION
WHEN OTHERS THEN
HTP.htmlopen; HTP.headopen; HTP.title('Archivo Descargado'); HTP.headclose; HTP.bodyopen; HTP.header(1, 'Estado de Descarga'); HTP.print('Descarga del archivo ' || lv_filePath || ' falló.'); HTP.print(SQLERRM); HTP.bodyclose; HTP.htmlclose;
END LEP_DESCARGA_ARCHIVO;
The problem is that Error shows too much information in the Error. LEP_DESCARGA_ARCHIVO is important for another process in my site. Where do i have to configure in Oracle in order to this Error does not appear??? I mean i do not want to get this Error if i type the URL:
https://mydomain.com/pls/docs/servlets/index.html Error: Descarga del archivo servlets/index.html falló. ORA-01403: no data found
h t t p s : / / m y d o m a i n . c o m / p l s / d o c s / Error: Descarga del archivo falló. ORA-01403: no data found
h t t p s : / / m y d o m a i n . c o m / p l s /d o c s / s e r v l e t s/ Error: Descarga del archivo servlets/ falló. ORA-01403: no data found
Thanks for people who can help me!!!Hello Peter,
I'm not sure whether this is a listener related problem, but we should try to find out.
I have examples where a temporary blob is created first before the content is passed to WPG_DOCLOAD, which produce a working download on the APEX Listener.
So I don't think the problem concerns WPG_DOCLOAD but the way you handle your blob, or to be precise, your BFILE.
What comes to my mind first: Don't you need to open that file? When I use DMBS_LOB.LOADBLOBFROMFILE, I guess this is done somewhere inside that routine, but for other kinds of bfile access, there is DBMS_LOB.FILEOPEN.
When thinking of that part: If I'm not completely wrong, there is a difference in which db user is acutally executing, or in other words, on whose behalf your code is executed, when you create a temporary blob first and forward it to wpg_docload or have wpg_docload do the file access. The Null Pointer Exception may result from either the file not being existent or not accessible for the db user executing the code. In case of wpg_docload accessing the file, perhaps the user you configured your APEX Listener to connect with needs additional grants for that file access.
Just a thought. It should be easy to test the same scenario with using a temporary file on APEX Listener to see if that works and start debugging from there.
-Udo -
No popup screen using wpg_docload.download.
Hello,
I want to download an xml via Apex. When I do this in Firefox it asks me where I want to save the document, which is what I want. In IE it just opens the xml in the browser. Can I force IE to show a popup to let the user save the file to his computer?
This is my code:
owa_util.mime_header(nvl(null,'application/octet'), FALSE);
htp.p('Content-length: ' || dbms_lob.getlength(v_blob) );
htp.p('Content-Disposition: filename="' || 'file.xml' || '"');
owa_util.http_header_close;
wpg_docload.download_file(v_blob);
Regards,
JanHi,
I too have an XML structure that is generated by a procedure. I am using ApEx 3.0.0. I have had this exact same thing working on another clients environment, but for some reason the same code does not work anymore on this environment.
Below is my PL/SQL procedure:
create or replace
PROCEDURE generateXmlForPatient(p_person_id IN VARCHAR2) AS
v_xml_complete XMLType;
v_xml_complete_clob CLOB;
v_count_length NUMBER;
v_family_name person.family_name%TYPE;
v_given_names person.given_names%TYPE;
BEGIN
SELECT
p.family_name
, p.given_names
INTO
v_family_name
, v_given_names
FROM
person p
WHERE
p.person_id = 'OTVP00001128501';
SELECT
XMLAGG(
XMLELEMENT("PATIENT_DETAILS",
XMLELEMENT("FAMILY_NAME",p.family_name),
XMLELEMENT("GIVEN_NAMES",p.given_names),
XMLELEMENT("GENDER",p.gender),
XMLELEMENT("ADMISSION_CAUSE",(SELECT rsf.suppinf FROM ref_suppinf rsf WHERE rsf.ref_suppinf_id = pt.ref_suppinf_id)),
XMLELEMENT("ADMISSION_DATE",to_char(pt.patient_date,'YYYY-MM-DD"T"HH24:MI:SS')),
XMLELEMENT("FACILITY_NAME",fy.facility_name),
XMLELEMENT("MEDICAL_STATUS_LIST",
(SELECT
XMLAGG(
XMLELEMENT("MEDICAL_STATUS",
XMLELEMENT("CASUALTY_DESC",(SELECT rcl.caslistingdescription FROM ref_casualtylisting rcl WHERE rcl.ref_casualtylisting_id = ms.ref_casualtylisting_id)),
XMLELEMENT("LATEST_PUBLISHED_STATUS",ms.published_communication),
XMLELEMENT("LATEST_STATUS_DATE",to_char(ms.createddate,'YYYY-MM-DD"T"HH24:MI:SS'))
FROM medical_status ms
WHERE ms.medical_visit_id = mv.medical_visit_id)
XMLELEMENT("COUNTRY",(SELECT rcy.countryname FROM ref_country rcy WHERE rcy.ref_country_id = p.ref_country_id)),
XMLELEMENT("COUNTRY_SERVED",(SELECT rcy.countryname FROM ref_country rcy WHERE rcy.ref_country_id = p.ref_country_served_id)),
INTO
v_xml_complete
FROM
person p
, patient pt
, facility fy
, medical_visit mv
WHERE p.person_id = 'OTVP00001128501'
AND pt.person_id = p.person_id
AND fy.facility_short_name = SUBSTR(pt.patient_id,0,4)
AND mv.patient_id = pt.patient_id;
-- Covert XMLType variable to a CLOB
v_xml_complete_clob := v_xml_complete.getClobVal();
-- Get the length of the XML Strucure
v_count_length := LENGTH(v_xml_complete_clob);
-- Generates pop-up box to allow user to save XML file to hard drive
owa_util.mime_header('text/xml',FALSE);
htp.p('Content-length: '|| v_count_length);
htp.p('Content-disposition: attachment; filename="'||v_family_name||'- '||v_given_names||'.xml"');
owa_util.http_header_close;
htp.prn(v_xml_complete_clob);
END generateXmlForPatient;I also have a button in my app that calls a process after submit. This process is a PL/SQL anonymous block containing:
BEGIN
generateXmlForPatient('1');
END;When the button is clicked it will refresh the page and put the process success message out, but it does not pop up the Save/Show download box.
Anybody have any ideas why this no longer works?
I look forward to hearing any suggestions.
Regards,
Cj -
Wpg_docload.download_file : 404 Error - File not found
Hello All,
I have a system where we have created a custom package to be able to pull down a image from the database using the generic wpg_docload.download_file procedure like so
owa_util.mime_header (nvl (l_mime, 'application/octet'), false);
htp.p ('content-length: ' || l_length);
owa_util.http_header_close;
wpg_docload.download_file (lob_loc);
end;This code works perfectly in our development environment.
However, we have recently launched to a production environment, and this code is not working. We are able to upload images ok, as we can retreive them in Toad, but in the apex environment, they are displayed with the IE red-cross icon, or the broken image icon in Firefox. When I try to just display the picture directly (http://myserver:7777/pls/apex/SCHEMA.utils.display?id=123), it returns a 404 file not found error.
As far as we know, all environments have the same setup as each other, and all the privileges are the same on all environments.
Any assistance in this matter would be appreciated.
Database: 10G R2
Apex version: 3.0Kate - If you had to grant execute privilege on the "SCHEMA.UTILS" package to FLOWS_030000 in order for the URL to work (http://myserver:7777/pls/apex/SCHEMA.utils.display?id=123) then the DAD may be configured incorrectly. You should (almost) never grant additional privileges to FLOWS_030000.
You should grant execute on the package to the user named in the DAD, as John said, either APEX_PUBLIC_USER or HTMLDB_PUBLIC_USER.
Scott
Maybe you are looking for
-
Tips & Tricks for daily forum reading?
At one point in time I used to visit the Arch forums quite actively in my efforts to contribute back to the community. More recently, I've stopped reading the forums but I now wish to get back into the "swing of things" and read/write the forums dai
-
Hi All, I just wanted to know whether we can process pdf files through FILE adapter in XI. If yes, Kindly let me know the procedure. Thanks in advance, Sudhasree.
-
How to synchronize two fpga DIO?
Hi! I am using two FPGA 7962R (flexrio) with each 6581 terminal board in PXIe-1082 chassis. My problem is how to synchronize two 7962R digital output with PXIe-1082 chassis backplane signal Dstar* or Clk10 or DAQ signal. Actually I tried the synchron
-
I am not able to solve the problem because I can't find an I/O vi that writes on file time stamp data. An error occurs, because of connecting different data types. How can I convert time stamp data so that I can use it as input in a write on file vi?
-
Robo freezes when opening or importing
I cannot open projects or import files or images in RoboHelp. I can open existing projects in Windows Explorer, but I cannot open them via File > Open, or by clicking Open...on the splash screen. I am trying to create a new project, but cannot import