title: I am getting error in compililing the trigger in oracle
body: <p>Need help on this trigger which updating a record when user perform update on particular column.
  Ex. here I have created a table orders as below.</p>
  
  <pre><code>CREATE TABLE orders
     ( order_id number(5),
       quantity number(4),
       status_c varchar2(15), 
       delete_date date,
       deleted_by_id varchar2(10));
  </code></pre>
  
  <p>I have inserted 2 records in it as below.</p>
  
  <pre><code>insert into orders values (1,25,'FAILED',null,null);
  insert into orders values (1,50,'QUEUED',null,null);
  
  select * from orders;
  </code></pre>
  
  <p>ORDER_ID   QUANTITY STATUS_C        DELETE_DA DELETED_BY</p>
  
  <hr>
  
  <pre><code>     1         25 FAILED
       1         50 QUEUED
  </code></pre>
  
  <p>Now we can see the values for column STATUS_C as 'FAILED' and 'QUEUED'</p>
  
  <p>So I whenever new user updates this table - orders , and make the status as 'DELETED' for status_c, then I need to capture his details such person_id and sysdate, So I have written a below trigger on that table - Orders</p>
  
  <pre><code>CREATE OR REPLACE TRIGGER orders_before_update
    BEFORE UPDATE
       ON orders
      FOR EACH ROW
  
    DECLARE
       v_username varchar2(10);
  
    BEGIN
  
     If UPDATING then
  
          if upper(:new.status_c) = 'DELETED' then
  
         -- Find username of person performing UPDATE on the table
         SELECT user INTO v_username
         FROM dual;
  
         -- Update delete_date field to current system date
         :new.delete_date := sysdate;
  
         -- Update deleted_by_id field to the username of the person performing the UPDATE
         :new.deleted_by_id := v_username   
  
      end if;
  
      end if;
     END;
     /
  </code></pre>
  
  <p>Warning: Trigger created with compilation errors.</p>
  
  <p>I got error while compile.</p>
  
  <p>I tried to udpate the table to see its impact,</p>
  
  <pre><code>    update orders set status_c = 'DELETED' where order_id = 1;
      update orders set status_c = 'DELETED' where order_id = 1
         *
  ERROR at line 1:
  ORA-04098: trigger 'DISDBA.ORDERS_BEFORE_UPDATE' is invalid and failed re-validation
  </code></pre>
  
  <p>I need help what is the issue in trigger, and why it is not compiling.</p>
  
  <p>When I checked the error using below query. it says.</p>
  
  <pre><code> `select * from user_errors where type = 'TRIGGER' and name` ='ORDERS_BEFORE_UPDATE';
  
  NAME                           TYPE           SEQUENCE       LINE   POSITION
  ------------------------------ ------------ ---------- ---------- ----------
  TEXT
  ----------------------------------------------------------------------------------------------------
  ORDERS_BEFORE_UPDATE           TRIGGER               1         20          5
  PLS-00103: Encountered the symbol "END" when expecting one of the following:
  
     . ( * @ % &amp; = - + ; &lt; / &gt; at in mod not rem
     &lt;an exponent (**)&gt; &lt;&gt; or != or ~= &gt;= &lt;= &lt;&gt; and or like
     between is null is not || is dangling
  The symbol ";" was substituted for "END" to continue.
  </code></pre>
  
  <p>Need help on this.</p>