title: Disable a trigger from a trigger Oracle
body: <p>I've stumbled on a situation where I need to disable a trigger from a trigger before doing an update, and then renable it.</p>
  
  <p>Basically, I have two tables:</p>
  
  <ul>
  <li><p><code>TIME_SLOTS</code> has fields such as start time, end time, to set the time
  slot for a programme as well as programme ID (foreign key) to specify
  which program.</p></li>
  <li><p><code>PROGRAMMES</code> contains a list of all the different available programs
  &amp; their details. Also contains a duration.</p></li>
  </ul>
  
  <p>I have an existing trigger that, when updating or inserting to <code>TIME_SLOTS</code>, the trigger lookups the duration from <code>PROGRAMMES</code> and ensures that End Time = Start Time + Duration.</p>
  
  <p>I also want to add a new trigger that updates the End Time in <code>TIME_SLOTS</code> when changing the duration in <code>PROGRAMMES</code>.</p>
  
  <p>I have set these two triggers up, but when changing the duration I get:</p>
  
  <pre><code>One error saving changes to table "SE217"."PROGRAMMES":
  Row 1: ORA-04091: table SE217.PROGRAMMES is mutating, trigger/function may not see it
  ORA-06512: at "SE217.SCHEDULES_VALID_TIMES", line 19
  ORA-04088: error during execution of trigger 'SE217.SCHEDULES_VALID_TIMES'
  ORA-06512: at "SE217.UPDATE_END_TIME", line 5
  ORA-04088: error during execution of trigger 'SE217.UPDATE_END_TIME'
  </code></pre>
  
  <p>This is obviously because when I change the duration, the 2nd trigger goes to update the end time in <code>TIME_SLOTS</code>. The trigger on <code>TIME_SLOTS</code> fires and looks up the duration - the duration is mutating and I get the error as above.</p>
  
  <p>It seems to me that when I update the <code>TIME_SLOTS</code> row with the newly calculated end time, I should just disable the trigger before and renable after the update - but as this is trigger I can't alter a trigger...</p>
  
  <p>Any ideas?</p>
  
  <p>EDIT: I had a thought that I could set a global variable and check this var in the trigger that I don't want to run etc - but wasn't sure how best to implement?</p>