It would be nice if there is a functionality to export/import all applications of a workspace into a single ZIP file. This is very usefull when we wish to backup our applications
I wold like support for this idea, It wold be a great improvement
for x in (select application_id from apex_applications where WORKSPACE in ('WORKSPACE1', 'WORKSPACE2')) loop sys_export_app(x.application_id, '', '', '', 'BACKUP'); end loop;
create or replace procedure sys_export_app(p_app_id in number , p_exp_ir_pub_rep in varchar2 , p_exp_ir_priv_rep in varchar2 , p_exp_ir_notif in varchar2 , p_ora_dir in varchar2) as l_clob clob; l_file_name varchar2(255); begin l_file_name := 'app' || p_app_id || '_export.sql'; l_clob := wwv_flow_utilities.export_application_to_clob(p_application_id => p_app_id , p_export_ir_public_reports => p_exp_ir_pub_rep , p_export_ir_private_reports => p_exp_ir_priv_rep , p_export_ir_notifications => p_exp_ir_notif); DBMS_XSLPROCESSOR.CLOB2FILE(l_clob, p_ora_dir, l_file_name); end sys_export_app;
and from system zip!
declare l_files apex_t_export_files; l_all_files apex_t_export_files := apex_t_export_files(); l_zip blob; l_export apex_data_export.t_export; l_original_id boolean := (:P4_ORIGIONAL_ID = 'Y'); l_app_ids apex_t_varchar2; begin l_app_ids := apex_string.split(:P4_SEL_APP_ID, ',');
for i in 1 .. l_app_ids.count loop l_files := apex_export.get_application( p_application_id => l_app_ids(i), p_with_original_ids => l_original_id, p_with_date => true, p_with_comments => true ); l_all_files := l_all_files multiset union all l_files; end loop;
if l_app_ids.count > 1 or :P4_ZIPFILE = 'Y' then l_zip := apex_export.zip(p_source_files => l_all_files); l_export.content_blob := l_zip; l_export.mime_type := 'application/zip'; l_export.file_name := case when l_app_ids.count > 1 then 'apps_export.zip' else 'f' || l_app_ids(1) || '.zip' end; l_export.format := 'zip'; l_export.as_clob := false; else l_export.content_clob := l_all_files(1).contents; l_export.mime_type := 'text/plain'; l_export.file_name := 'f' || l_app_ids(1) || '.sql'; l_export.format := 'sql'; l_export.as_clob := true; end if;
apex_data_export.download(p_export => l_export); end;
P4_ORIGIONAL_ID - Incase you want the option like original id then use this page item to set value dynamically
for a single file you want as zipfile or non zipfile you've option to pass dynamcially with the help of P4_ZIPFILE item
Demo_Application_Link