title: newbie on using Oracle Scheduler to start a job based on event
body: <p>I have a table in Oracle 11.2 database. I want the database to run an executable file on a remote server if a specific cell in table1 is updated to a value of 1 AND if the number of existing rows in table2 is > 0. I don't have much experience with what is possible in databases -- is the following possible to achieve this?</p>
  
  <ol>
  <li><p>create a job using Oracle Scheduler. The job runs immediately, and is used to run an external executable program on a remote server. The job exists, but is not run until step 5 below (is this possible?).
  <a href="http://docs.oracle.com/cd/E11882_01/server.112/e17120/schedadmin001.htm#BAJHIDDC" rel="nofollow">http://docs.oracle.com/cd/E11882_01/server.112/e17120/schedadmin001.htm#BAJHIDDC</a></p></li>
  <li><p>attach a DML trigger to the column of the table that fires on an UPDATE statement.
  <a href="http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#CIHEHBEB" rel="nofollow">http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#CIHEHBEB</a></p></li>
  <li><p>have the trigger invoke a PL/SQL subprogram 
  <a href="http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#CIHEGACF" rel="nofollow">http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#CIHEGACF</a></p></li>
  <li><p>in the PL/SQL subprogram, perform the following business logic: if a specific cell in table1 equals 1, AND if the number of rows in table 2 is greater than 0, proceed to step 5, otherwise stop (exit, quit). </p></li>
  <li><p>Run the job in step 1</p></li>
  </ol>
  
  <p>Or, if the job/scheduler is not made to provide this functionality, is there another way to achieve the same thing? That is, have a change in a database table trigger an external job. </p>
  
  <p>UPDATE 1:</p>
  
  <p>I wonder if it's possible to implement steps 1-5 above by just using Oracle Scheduler with <code>DBMS_SCHEDULER.CREATE_JOB</code> using parameter <code>event_condition</code>?</p>
  
  <p><a href="http://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse005.htm#CHDIAJEB" rel="nofollow">http://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse005.htm#CHDIAJEB</a></p>
  
  <p>Here's an example from the above link:</p>
  
  <pre><code>BEGIN
  DBMS_SCHEDULER.CREATE_JOB (
     job_name            =&gt;  'process_lowinv_j1',
     program_name        =&gt;  'process_lowinv_p1',
     event_condition     =&gt;  'tab.user_data.event_type = ''LOW_INVENTORY''',
     queue_spec          =&gt;  'inv_events_q, inv_agent1',
     enabled             =&gt;  TRUE,
     comments            =&gt;  'Start an inventory replenishment job');
  END;
  </code></pre>
  
  <p>The above code creates a job that starts when an application signals the Scheduler that inventory levels for an item have fallen to a low threshold level. </p>
  
  <p>Could the above code somehow be modified to perform the intended steps? For example, could steps 2-4 above be eliminated by using <code>event_condition</code> here instead? etc. If so, what would it look like, for example, how to set the <code>queue_spec</code>? </p>