title: Using 'exec' in Oracle trigger code
body: <p>i tried to create a Oracle trigger, after the table is insert or update, touch a file in the Linux host.</p>
  
  <p>so i create a shell script like that:</p>
  
  <pre><code>#!/bin/bash
  touch  /export/home/oracle/shell/a.txt
  </code></pre>
  
  <p>and modify the permission:</p>
  
  <pre><code>chmod +x test1.sh
  </code></pre>
  
  <p>then i use the sys login oracle and create a scheduler job like this:</p>
  
  <pre><code>SQL&gt;  exec DBMS_SCHEDULER.CREATE_JOB(job_name=&gt;'test1',job_type=&gt;'EXECUTABLE',job_action=&gt;'/export/home/oracle/shell/test1.sh');
  PL/SQL procedure successfully completed.
  </code></pre>
  
  <p>now i want to create a Oracle trigger and call this scheduler job like this:</p>
  
  <pre><code>CREATE OR REPLACE TRIGGER MY_OAM_LOG
   AFTER INSERT OR UPDATE ON OCS_CHARGE_OFF_AUTOMATION
   FOR EACH ROW 
  BEGIN
   exec DBMS_SCHEDULER.RUN_JOB(job_name=&gt;'test1');
  END;
  /
  </code></pre>
  
  <p>but error:</p>
  
  <pre><code>SQL&gt; CREATE OR REPLACE TRIGGER MY_OAM_LOG
    2   AFTER INSERT OR UPDATE ON OCS_CHARGE_OFF_AUTOMATION
    3   FOR EACH ROW 
    4  BEGIN
    5   exec DBMS_SCHEDULER.RUN_JOB(job_name=&gt;'test1');
    6  END;
    7  /
  
  Warning: Trigger created with compilation errors.
  
  SQL&gt; show error
  Errors for TRIGGER MY_OAM_LOG:
  
  LINE/COL
  --------------------------------------------------------------------------------
  ERROR
  --------------------------------------------------------------------------------
  2/7
  PLS-00103: Encountered the symbol "DBMS_SCHEDULER" when expecting one of the fol
  lowing:
  
     := . ( @ % ;
  The symbol ":=" was substituted for "DBMS_SCHEDULER" to continue.
  </code></pre>
  
  <p>i have search many solution,bu none of them are work.how do i deal with it?plz.</p>