Edit D:\app\Administrator\product\11.2.0\dbhome_1\apex\images\doc\AEAPI\apex_plsql_job005.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>UPDATE_JOB_STATUS Procedure</title> <meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1" /> <meta name="date" content="2009-04-14T17:32:17Z" /> <meta name="robots" content="noarchive" /> <meta name="doctitle" content="UPDATE_JOB_STATUS Procedure" /> <meta name="relnum" content="Release 3.2" /> <meta name="partnum" content="E12510-01" /> <link rel="copyright" href="../dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> <link rel="stylesheet" href="../dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /> <link rel="contents" href="toc.htm" title="Contents" type="text/html" /> <link rel="up" href="preface" title="Home" type="text/html" /> <link rel="up" href="apex_plsql_job.htm" title="APEX_PLSQL_JOB" type="text/html" /> <link rel="up" href="apex_plsql_job005.htm" title="UPDATE_JOB_ST..." type="text/html" /> <link rel="prev" href="apex_plsql_job004.htm" title="Previous" type="text/html" /> <link rel="next" href="apex_lang.htm" title="Next" type="text/html" /> </head> <body> <p id="BREADCRUMBING"><a href="preface" title="Home">Home</a> > <a href="apex_plsql_job.htm" title="APEX_PLSQL_JOB">APEX_PLSQL_JOB</a> > UPDATE_JOB_ST...</p> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr valign="bottom"> <td align="left"></td> <td align="center"><a href="apex_plsql_job004.htm"><img src="../dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="apex_lang.htm"><img src="../dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> <p><a id="BGBHHCHH" name="BGBHHCHH"></a></p> <hr /> <div class="refsect1"> <h1><a id="sthref1089" name="sthref1089"></a>UPDATE_JOB_STATUS Procedure</h1> <p>Call this procedure to update the status of the currently running job. This procedure is most effective when called from the submitted PL/SQL.</p> <a id="sthref1090" name="sthref1090"></a> <p class="subhead2">Syntax</p> <pre xml:space="preserve" class="oac_no_warn"> APEX_PLSQL_JOB.UPDATE_JOB_STATUS ( p_job IN NUMBER, p_status IN VARCHAR2); </pre> <a id="sthref1091" name="sthref1091"></a> <p class="subhead2">Parameters</p> <p><a href="#BGBHJHDE">Table: UPDATE_JOB_STATUS Parameters</a> describes the parameters available in the UPDATE_JOB_STATUS procedure.</p> <div class="tblformal"><a id="sthref1092" name="sthref1092"></a><a id="BGBHJHDE" name="BGBHJHDE"></a> <p class="titleintable">UPDATE_JOB_STATUS Parameters</p> <table class="Formal" title="UPDATE_JOB_STATUS Parameters" summary="This table describes the parameters available in the REMOVE_PREFERENCE procedure." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"> <col width="41%" /> <col width="*" /> <thead> <tr align="left" valign="top"> <th align="left" valign="bottom" id="r1c1-t5">Parameter</th> <th align="left" valign="bottom" id="r1c2-t5">Description</th> </tr> </thead> <tbody> <tr align="left" valign="top"> <td align="left" id="r2c1-t5" headers="r1c1-t5"> <p><code>p_job</code></p> </td> <td align="left" headers="r2c1-t5 r1c2-t5"> <p>Passed the reserved word JOB. When this code is executed it will have visibility to the job number via the reserved word JOB.</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r3c1-t5" headers="r1c1-t5"> <p>p_status</p> </td> <td align="left" headers="r3c1-t5 r1c2-t5"> <p>Plain text that you want associated with</p> <p><code>JOB: p_job</code>.</p> </td> </tr> </tbody> </table> <br /></div> <!-- class="tblformal" --> <a id="sthref1093" name="sthref1093"></a> <p class="subhead2">Example</p> <p>The following example shows how to use the UPDATE_JOB_STATUS procedure. In this example, note that:</p> <ul> <li> <p>Lines 002 to 010 run a loop that inserts 100 records into the emp table.</p> </li> <li> <p><code>APP_JOB</code> is referenced as a bind variable inside the <code>VALUES</code> clause of the <code>INSERT</code>, and specified as the <code>p_job</code> parameter value in the call to <code>UPDATE_JOB_STATUS</code>.</p> </li> <li> <p><code>APP_JOB</code> represents the job number which will be assigned to this process as it is submitted to <code>APEX_PLSQL_JOB</code>. By specifying this reserved item inside your process code, it will be replaced for you at execution time with the actual job number.</p> </li> <li> <p>Note that this example calls to <code>UPDATE_JOB_STATUS</code> every ten records, inside the block of code. Normally, Oracle transaction rules dictate updates made inside code blocks will not be seen until the entire transaction is committed. The <code>APEX_PLSQL_JOB.UPDATE_JOB_STATUS</code> procedure, however, has been implemented in such a way that the update will happen regardless of whether or not the job succeeds or fails. This last point is important for two reasons:</p> <ol> <li> <p>Even if your status shows "100 rows inserted", it does not mean the entire operation was successful. If an error occurred at the time the block of code tried to commit, the user_status column of <code>APEX_PLSQL_JOBS</code> would not be affected because status updates are committed separately.</p> </li> <li> <p>Updates are performed autonomously. You can view the job status before the job has completed. This gives you the ability to display status text about ongoing operations in the background as they are happening.</p> </li> </ol> </li> </ul> <pre xml:space="preserve" class="oac_no_warn"> BEGIN FOR i IN 1 .. 100 LOOP INSERT INTO emp(a,b) VALUES (:APP_JOB,i); IF MOD(i,10) = 0 THEN APEX_PLSQL_JOB.UPDATE_JOB_STATUS( P_JOB => :APP_JOB, P_STATUS => i || ' rows inserted'); END IF; APEX_UTIL.PAUSE(2); END LOOP; END; </pre></div> <!-- class="refsect1" --> <!-- Start Footer --> <div class="footer"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr> <td align="left"><span class="copyrightlogo">Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.</span><br /> <a href="../dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td> <td align="center"><a href="apex_plsql_job004.htm"><img src="../dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="apex_lang.htm"><img src="../dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> </div> <!-- class="footer" --> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de