This discussion is archived
1 Reply Latest reply: Nov 18, 2010 9:10 AM by jariola RSS

dbms_job submit status

user5603570 Newbie
Currently Being Moderated
Hi,
I need to disable/hide the submit button after i submit the job using dbms_job submit process.
Also after after completion needs to enable the button.

Is there any background process i can run which enable or disable the button?

Thanks,
K
  • 1. Re: dbms_job submit status
    jariola Guru
    Currently Being Moderated
    Hi,

    Client (your browser) need check status from server.

    Here is one example that might help
    https://apex.oracle.com/pls/otn/f?p=40323:69

    When you press "Submit Job" button page is submitted and process creates job using APEX_PLSQL_JOB.
    Then window is refresh every 10 sec, until job finish.

    I did create application item G_META_TAG
    I did place to page HTML header
    &G_META_TAG.
    Then I did create display only item Px_JOB_RUNNING and Px_JOB_ID

    Computation "PL/SQL Function body" for Px_JOB_RUNNING
    FOR c1 IN(
      SELECT 1
      FROM apex_plsql_jobs
      WHERE (job = :Px_JOB_ID OR :Px_JOB_ID IS NULL)
      AND system_status = 'COMPLETE'
    )LOOP
      RETURN 'No';
    END LOOP;
    RETURN 'Yes';
    Computation "PL/SQL Function body" for G_META_TAG
    IF :Px_JOB_RUNNING = 'Yes' THEN
      RETURN '<meta http-equiv="refresh" content="10">';
    ELSE
      RETURN NULL;
    END IF;
    Then submit button conditionally Px_JOB_RUNNING value "No".

    Page after submit process
    DECLARE
      l_sql VARCHAR2(4000);
      l_job NUMBER;
    BEGIN
      l_sql := '
        BEGIN
          FOR i IN 1..3
          LOOP
            APEX_UTIL.PAUSE(10);
          END LOOP;
        END;
      ';
      l_job := APEX_PLSQL_JOB.SUBMIT_PROCESS(
        p_sql => l_sql,
        p_status => 'Background process submitted'
      );
      --store l_job for later reference
      :PX_JOB_ID := l_job;
      :PX_JOB_RUNNING := 'Yes';
    END;
    I did make process conditionally by submit button and Px_JOB_RUNNING value "No"

    This is not ready solution and probably have bugs.
    One thing is specially how you check is job running.
    My sample stores job id to item session state. Value is lost if user logout, close browser or clears cache.
    Then user can submit job again, even previous job is running.

    Anyway I hope it give idea for you how continue.

    You can do similar check using Ajax/dynamic actions. Then whole window is not refreshed.

    Regards,
    Jari

    Edited by: jarola on Nov 18, 2010 7:10 PM

    Here is sample using Ajax
    http://actionet.homelinux.net/htmldb/f?p=100:93

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points