This happens with triggers. It occurs because the trigger is trying to update a row it is currently using. The usual fix involves either use of views or temporary tables so the database is selecting from one while updating the other
How we can get nth max salary from Employee Table (EMP_ID, Salary)
Emp_id salary 1 1000 3 2000 4 16000 2 10000 7 19000 8 12000
e.g. for 3rd max salary, salary is 12000 so answer will be emp_id : 8