Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Download BLOB - wpg_docload.download_file

Chintan GandhiAug 13 2018 — edited Aug 14 2018

Hi,

I am working with:

APEX - 5.0.3.00.03

Oracle DB - 11gR1

I have a blob column and an Oracle APEX page to download file.

Code to download file:

declare

    l_blob blob;

    l_sql_delimiter varchar2(30);

    l_lang_context  integer := DBMS_LOB.DEFAULT_LANG_CTX;

    l_warning       integer := DBMS_LOB.WARN_INCONVERTIBLE_CHAR;

    l_dest_offset   integer := 1;

    l_source_offset integer := 1;

   

    ln_length number;

    LV_TABLENAME VARCHAR2(100);

    LV_FILENAME VARCHAR2(1000);

   

    LN_JOB_ID NUMBER;

begin

--  SELECT C.N001 into LN_JOB_ID FROM APEX_COLLECTIONS C

--  WHERE C.COLLECTION_NAME = 'DOWNLOAD_INFO';

--    LV_FILENAME := LV_TABLENAME ||  '.txt';

    dbms_lob.createtemporary(l_blob, true);

   

    select file_name, file_content into lv_filename, l_blob from XXDM_REPORT_DOWNLOADS

where job_id  = :P5183_JOB_ID;

   

ln_length := DBMS_LOB.GETLENGTH(l_blob);

sys.htp.init;

    sys.owa_util.mime_header( 'application/octet-stream', false,'UTF-8' );

    sys.htp.p('Content-length: ' || to_char(ln_length));

    sys.htp.p('Content-Disposition: inline; filename="' || LV_FILENAME || '"' );

    sys.owa_util.http_header_close;

    sys.wpg_docload.download_file(l_blob);

    apex_application.stop_apex_engine;

exception when others then

    sys.htp.prn('error: '||sqlerrm);

    apex_application.stop_apex_engine;

end;

Issue: I have a file with 4GB size stored in this BLOB column. When user is trying to download this file, it is downloading only 325 MB and ignoring rest.

Is it possible to achieve download of such large file? If so, can you please help me fix this issue?

Thanks,

Chintan

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 11 2018
Added on Aug 13 2018
2 comments
584 views