Executing Long-Running Processes with Execution Chains in Oracle APEX

Executing Long-Running Processes with Execution Chains in Oracle APEX

As developers, we often face scenarios where even after optimizing code, processes take considerable time to execute. In such situations, we can't afford to keep our end-users waiting or risk a timeout error.

This is where Execution Chains in Oracle APEX (introduced in version 23.2) come to the rescue! Execution Chains allow you to create sequences of processes that can run either in the foreground or background, making them a great alternative to handling lengthy tasks. Essentially, they function like a wrapper around DBMS_SCHEDULER.

1. How to Create an Execution Chain Process

  • Go to ProcessesCreate Process → Select Type: Execution Chain

Article content

2. Key Attributes of an Execution Chain

Here’s a rundown of the main attributes you’ll encounter when working with Execution Chains:

  • Type: Execution Chain Indicates that you want to execute a sequence of page processes in either the foreground or background.
  • Execution Chain: None This tells APEX which execution chain the process belongs to. For the 'Top Level' process, this should be set to None.
  • Run in Background: Selected This is a critical setting! It tells APEX to run the process in the background, ensuring the main application remains responsive.
  • Return ID into Item: <APEX_PAGE_ITEM> This setting returns the execution ID into a page item, allowing you to track the current status of the background process.
  • Context Value Item: <APEX_PAGE_ITEM> This determines whether the background process can run in parallel with other processes based on the context value.
  • Executions Limit: If specified, this limits the number of background executions a user can initiate within a session. For example, setting a limit of 3 will show an error if the user attempts to run a fourth background process.
  • Submit Immediately: Enabled Enabling this ensures the background process starts immediately, even outside of the current transaction—similar to an autonomous transaction.
  • Serialization Serialize: Disabled When another background process is running, the execution will wait or trigger an error depending on the Serialization setting. Available options: Wait: The new execution will wait for the previous one to complete. Error: An error will be raised if another execution with the same context value is running.

Article content
Article content

 

3. How to Monitor Background Process Progress

You can track the progress of a background process using one of these methods:

  • SessionBackground Process
  • Query the view provided by Oracle APEX:

SELECT * FROM APEX_APPL_PAGE_BG_PROC_STATUS;


Execution Chains in Oracle APEX are a powerful feature to ensure your applications remain performant and responsive, even during heavy processes. If you're not using them yet, now’s the perfect time to start leveraging this functionality!

Article content

#OracleAPEX #OrclAPEX #Oracle #ExecutionChains #PerformanceOptimization #BackgroundProcessing #OracleDevelopers #APEXDevelopment #APEXFeatures #WebDevelopment #SoftwareDevelopment #APEXTips #Oracle

Great post! Execution chains in Oracle APEX are a powerful feature for managing long-running processes. They allow you to break down complex tasks into smaller steps and control the flow of execution. This can help improve performance and user experience in your applications. Thanks for sharing this valuable information!

To view or add a comment, sign in

Others also viewed

Explore content categories