-- grab the contents of a page generated by the PL/SQL Web Toolkit (without invoking it through a web server/gateway) declare l_clob clob; begin debug_pkg.debug_on; owa_util_pkg.init_owa; -- call any procedure that outputs something via htp.p --apex; -- the standalone "apex" procedure is a shortcut to the apex login page f(p => '4550:1'); -- note that since we are not logged in, this will simply return a Location header that tells the browser to redirect to a login page l_clob := owa_util_pkg.get_page; debug_pkg.print(l_clob); file_util_pkg.save_clob_to_file ('DEVTEST_TEMP_DIR', 'my_web_page_generated_by_owa.htm', l_clob); end; -- use the (undocumented) APEX_UTIL.EXPORT_APPLICATION procedure to generate an export file -- then grab the output and save it to file declare l_workspace_id number; l_app_id number; l_clob clob; begin debug_pkg.debug_on; select workspace_id, application_id into l_workspace_id, l_app_id from apex_applications where workspace = 'DEVTEST' and application_name = 'AlexandriaLibraryTestApp'; owa_util_pkg.init_owa; apex_util.export_application (p_workspace_id => l_workspace_id, p_application_id => l_app_id); --apex_util.export_application_page (p_workspace_id => l_workspace_id, p_application_id => l_app_id, p_page_id => 9); l_clob := owa_util_pkg.get_page (p_include_headers => false); --debug_pkg.print (l_clob); file_util_pkg.save_clob_to_file ('DEVTEST_TEMP_DIR', 'my_export_of_f' || l_app_id || '_' || to_char(sysdate, 'yyyymmddhh24miss') || '.sql', l_clob); end;