Skip to main content

Posts

Showing posts from October, 2020

Generating ZIP files in Oracle APEX

APEX_ZIP API was introduced in APEX version 5.0. It has made generating zip files from the database easy. Nothing has changed with this API since then. Here is the sample code to generate a zip file using these APIs. DECLARE l_zip_file BLOB ; BEGIN -- zip all the files uploaded to current application "Static Application Files" FOR l_file IN ( SELECT filename file_name ,blob_content file_content FROM apex_application_files WHERE flow_id = :APP_ID )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; BEGIN apex_zip.finish(p_zipped_blob => l_zip_file); EXCEPTION WHEN value_error THEN -- if there is no file added so far, then apex_zip.finish raises VALUE_ERROR -- do nothing ...