Skip to Main Content

SQL & PL/SQL

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/chunk a large zip

BlackWolfDesignMay 10 2017 — edited May 11 2017

Hi everyone,

i create a pl/sql-statement. This statement create a zip-file and download it(the zip-file contains many pictures). Normally the file is too large for any browsers. i need to create & download an empty zip file and fill it step by step with pictures. So I do not load 1x500mb rather 100x5mb. How can i solve it? with htp.p/rn? i dont know . i tried this link: http://goldthorp.com/?m2=plsql&menu=mod-plsql&page=file-download&subpage=Download%20BLOB

declare

  L_LENGTH INTEGER;

  L_ZIP_FILE BLOB;

               

begin

    for l_file in (MY_SQL_STATEMENT

    )loop

        apex_zip.add_file (

            p_zipped_blob => L_ZIP_FILE,

            p_file_name   => l_file.file_name,

            p_content     => l_file.file_content );

    end loop;

    apex_zip.finish (

        p_zipped_blob => L_ZIP_FILE);

  L_LENGTH := dbms_lob.getlength(L_ZIP_FILE);

    -- set up HTTP header

    owa_util.mime_header('application/zip', false);

    -- set the size so the browser knows how much to download

    htp.p('Content-length: ' || L_LENGTH);

    -- the filename will be used by the browser if the users does a save as

    htp.p('Content-Disposition: attachment; filename="results.zip"');

    -- close the headers

    owa_util.http_header_close;

    -- download the file

    wpg_docload.download_file(L_ZIP_FILE);

EXCEPTION

    WHEN OTHERS THEN

    htp.htmlopen;

    htp.headopen;

    htp.title('File Downloaded');

    htp.headclose;

  htp.bodyopen;

  htp.header(1, 'Download Status');

  htp.p(SQLERRM);

  htp.p('<br>');

  htp.p('name is : results.zip');

  htp.bodyclose;

  htp.htmlclose;

end;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2017
Added on May 10 2017
6 comments
697 views