10 Replies Latest reply: Jan 22, 2014 4:38 AM by Hoek RSS

    how to avoid this mutating error

    infochandu

      I have created the below trigger and after created it's not allowing me to insert rows into employees table. I would like to know where it's giving an error.

      CREATE OR REPLACE TRIGGER update_employees 
      AFTER INSERT ON employees 
      FOR EACH ROW 
      BEGIN 
      UPDATE employees SET    hire_date = sysdate WHERE  employee_id = :new.employee_id; 
      END update_employees; /

      I want to insert an employee details and after insertion it has to update the hiredate as sysdate.

       

      Please let me know how to do this.

       

      Has one way, we can make default value for hiredate as sysdate. But how can do with this triggers.

       

      Thanks