drop table if exists t1; create table t1 (a text, b text, c text); insert into t1 values ('a1', 'b1', 'c1'), ('a2', 'b2', 'c2'), ('a3', 'b3', 'c3'), ('a4', 'b4', 'c4'), ('a5', 'b5', 'c5'); select * from t1; begin; declare c1 cursor for select * from (select a, b, c from t1 order by a asc) _ order by a asc for update; fetch first from c1; delete from t1 where current of c1; select * from t1; fetch first from c1; delete from t1 where current of c1; select * from t1; fetch first from c1; delete from t1 where current of c1; select * from t1; commit;