<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[APEX Insights - Eduardo Land]]></title><description><![CDATA[APEX Insights - Eduardo Land]]></description><link>https://apex-insights-eduardo-land.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 07:05:21 GMT</lastBuildDate><atom:link href="https://apex-insights-eduardo-land.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Bulk Export Oracle APEX Applications: Automating Workspace Backups with PL/SQL]]></title><description><![CDATA[Learn how to automate the export of all applications from an Oracle APEX workspace and package them into a downloadable ZIP file using a simple PL/SQL script.
The Script
DECLARE
    v_workspace    VARCHAR2(255) := 'ORACLE'; -- Change to your workspac...]]></description><link>https://apex-insights-eduardo-land.hashnode.dev/bulk-export-oracle-apex-applications-automating-workspace-backups-with-plsql</link><guid isPermaLink="true">https://apex-insights-eduardo-land.hashnode.dev/bulk-export-oracle-apex-applications-automating-workspace-backups-with-plsql</guid><category><![CDATA[Oracle]]></category><category><![CDATA[#oracle-apex]]></category><category><![CDATA[PL/SQL]]></category><category><![CDATA[Export]]></category><dc:creator><![CDATA[Eduardo Land]]></dc:creator><pubDate>Tue, 02 Sep 2025 17:00:04 GMT</pubDate><content:encoded><![CDATA[<p>Learn how to automate the export of all applications from an Oracle APEX workspace and package them into a downloadable ZIP file using a simple PL/SQL script.</p>
<h2 id="heading-the-script">The Script</h2>
<pre><code class="lang-sql"><span class="hljs-keyword">DECLARE</span>
    v_workspace    <span class="hljs-built_in">VARCHAR2</span>(<span class="hljs-number">255</span>) := <span class="hljs-string">'ORACLE'</span>; <span class="hljs-comment">-- Change to your workspace</span>
    v_blob         BLOB;
    v_files        apex_t_export_files;
    v_filename     VARCHAR2(255);
    v_mimetype     VARCHAR2(255) := 'application/zip';
    v_workspace_id NUMBER;
<span class="hljs-keyword">BEGIN</span>
    <span class="hljs-comment">-- Set workspace security context</span>
    v_workspace_id := apex_util.find_security_group_id(p_workspace =&gt; v_workspace);
    apex_util.set_security_group_id(p_security_group_id =&gt; v_workspace_id);

    <span class="hljs-comment">-- Initialize ZIP file</span>
    sys.dbms_lob.createtemporary(v_blob, TRUE);

    <span class="hljs-comment">-- Export all applications from workspace</span>
    FOR r IN (
        <span class="hljs-keyword">SELECT</span> application_id, workspace_display_name
        <span class="hljs-keyword">FROM</span> apex_applications
        <span class="hljs-keyword">WHERE</span> <span class="hljs-keyword">UPPER</span>(workspace) = <span class="hljs-keyword">UPPER</span>(v_workspace)
    ) <span class="hljs-keyword">LOOP</span>
        v_filename := r.workspace_display_name;
        v_files := apex_export.get_application(p_application_id =&gt; r.application_id);
        apex_zip.add_file(
            p_zipped_blob =&gt; v_blob, 
            p_file_name =&gt; 'f' || r.application_id || '.sql', 
            p_content =&gt; apex_util.clob_to_blob(v_files(1).contents)
        );
    <span class="hljs-keyword">END</span> <span class="hljs-keyword">LOOP</span>;

    <span class="hljs-comment">-- Finalize and download ZIP</span>
    apex_zip.finish(v_blob);
    apex_http.download(
        p_blob =&gt; v_blob, 
        p_content_type =&gt; v_mimetype, 
        p_filename =&gt; v_filename || '.zip'
    );
<span class="hljs-keyword">END</span>;
</code></pre>
<h2 id="heading-how-it-works">How It Works</h2>
<ol>
<li><p><strong>Security Context</strong>: Sets the workspace security context to access applications</p>
</li>
<li><p><strong>Application Discovery</strong>: Queries all applications in the specified workspace</p>
</li>
<li><p><strong>Export Loop</strong>: Exports each application and adds it to a ZIP file</p>
</li>
<li><p><strong>Download</strong>: Triggers automatic download of the ZIP file containing all apps</p>
</li>
</ol>
<h2 id="heading-implementation-steps">Implementation Steps</h2>
<ol>
<li><p><strong>Create a Button</strong>: Add a "Download Apps" button to your page</p>
<ul>
<li><p>Set Action: "Redirect to Page in this Application" and redirect to the same page</p>
</li>
<li><p>Set Request: "DOWNLOAD_APPS"</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756831683638/f21c46b5-d322-4590-a749-7dc5ea92ab1c.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
<li><p><strong>Create Page Process</strong>: Add a "Before Header" process</p>
<ul>
<li><p>Type: PL/SQL Code</p>
</li>
<li><p>Paste the script above</p>
</li>
<li><p>Server-side Condition: "Request" or "Request is contained in Value" = "DOWNLOAD_APPS"</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756831710199/59f92557-4857-4f54-945c-5a91f2728745.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
<li><p><strong>Customize</strong>: Change the <code>v_workspace</code> variable to your workspace name</p>
</li>
</ol>
<h2 id="heading-benefits">Benefits</h2>
<ul>
<li><p><strong>Batch Processing</strong>: Export all applications at once</p>
</li>
<li><p><strong>Automated Packaging</strong>: Creates a ready-to-download ZIP file</p>
</li>
<li><p><strong>Time Saving</strong>: No manual export for each application</p>
</li>
<li><p><strong>Backup Ready</strong>: Perfect for creating workspace backups</p>
</li>
</ul>
<p>This script is ideal for workspace migrations, backup procedures, or setting up deployment pipelines in Oracle APEX.</p>
]]></content:encoded></item></channel></rss>