11.7 SET_PROGRESS Procedure

This procedure sets progress of an execution. This procedure must be called from within PL/SQL code.

Use the GET_EXECUTION function to retrieve information.

Syntax

APEX_BACKGROUND_PROCESS.SET_PROGRESS (
    p_totalwork IN NUMBER DEFAULT NULL,
    p_sofar     IN NUMBER )

Parameters

Parameter Description
p_totalwork Total units of work to be processed by the background process.
p_sofar Units of work being processed so far.

Example 1

The following example demonstrates a PL/SQL page process running in the background with a known total amount of work to process. Progress is reported to the Oracle APEX engine as follows.

BEGIN
    for i in 1 .. 1000 loop
        do_something( p_param => i );
        apex_background_process.set_progress(
            p_totalwork   => 1000,
            p_sofar       => i );
    END loop;
END;

Example 2

The following example demonstrates a PL/SQL page process running in the background with an unknown total amount work to process. Progress is reported to the APEX engine as follows.

DECLARE
    l_rows_processed pls_integer := 1;
BEGIN
    for i ( select * from emp ) loop
        do_something( p_param => i.empno );
        apex_background_process.set_progress(
            p_sofar       => l_rows_processed );
        l_rows_processed := l_rows_processed + 1;
    END loop;
END;