title: Order of execution of trigger and statements in Oracle stored procedure
body: <p>Below are my table structures :</p>
  
  <pre><code>Table -Customer
  CustomerID Blacklisted Customer Name
  101 Y ABC
  102 Y DEF
  
  Table -Blacklist
  CustomerID BlacklistID Customer Name
  101 1011 ABC
  102 1012 DEF
  
  Table -Reason
  BlacklistID ReasonID Reason Code
  1012 02 Rcode2
  </code></pre>
  
  <p>Main table "Customer" is to store customer information.There is a trigger after update on table "Customer" to insert record in table "Blacklist" if somebody updates the blacklisted as Y in customer table.
  We consider the customer as blacklisted if ,</p>
  
  <ul>
  <li>Blacklisted column in Customer table as value 'Y' and. </li>
  <li>There are records present for customer in Blacklist and Reason table</li>
  </ul>
  
  <p>Now my requirement is to blacklist the customer from backend.For this i am writing stored procedure with below queries:</p>
  
  <ol>
  <li>Update customer set blacklisted ='Y' where customerid='102';</li>
  <li>select BlacklistID into var_id from blacklist where customerid='102';</li>
  <li>Insert into reason(BlacklistID,ReasonID,ReasonCode)values(var_ id,111,'RCODE1');</li>
  </ol>
  
  <p>Now to insert entry in Reason table(step-3),i need BlacklistID which is a foreign key and i will get the value of BlacklistID once the trigger on customer table gets exceuted.So my confusion is, can i assume the trigger on update of 'Customer' table will always get excuted before the cntrl reaches my INSERT INTO reason(step-3) statement. Please suggest. </p>