I have the following trigger:
CREATE DEFINER=root@localhost TRIGGER after_insert_student after INSERT ON 
students FOR EACH ROW BEGIN 
    SET @NEWID := NEW.ID ;
if @NEWID IS NOT NULL THEN     
     INSERT INTO students SET ID = @NEWID;
else
     INSERT INTO students SET ID = 001;
END IF
END
ERROR:
Error Code: 1442. Can't update table 'students' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.