title: Trigger — is invalid and failed re-validation
body: <p>I am trying to create this simple trigger :</p>
  
  <pre><code>  CREATE OR REPLACE TRIGGER my_trig 
    BEFORE DELETE OR INSERT OR UPDATE ON empcopy 
    FOR EACH ROW 
    WHEN (NEW.EID &gt; 0) 
    DECLARE 
    sal_diff number; 
    BEGIN 
  
   sal_diff := :NEW.salary  - :OLD.salary; 
   dbms_output.put_line('Old salary: ' || :OLD.salary); 
   dbms_output.put_line('New salary: ' || :NEW.salary); 
   dbms_output.put_line('Salary difference: ' || sal_diff); 
   COMMIT;
    END; 
    /
  </code></pre>
  
  <p>on execution it gives the result as:</p>
  
  <pre><code>   Trigger created
  </code></pre>
  
  <p>But when I update my table the following result is obtained:</p>
  
  <pre><code>  update empcopy
    set salary=salary+5000;
  </code></pre>
  
  <p>after execution:</p>
  
  <pre><code>  error at line 1 
    ORA-0498:triiger 'HR.MY_TRIG' is invalid and failed re-validation.
  </code></pre>