FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.26k stars 217 forks source link

no current record for fetch operation - FB40 #6969

Open EPluribusUnum opened 3 years ago

EPluribusUnum commented 3 years ago

Hi!

You can find the database and the sql in the attached zip. Firebird : latest snapshot FB40.

no_current_record_for_fetch_operation.zip

dyemanov commented 3 years ago

The issue is related to #6901. Simplified test case (based on the examples in the mentioned ticket):

create table t (id int, val int);
insert into t values (1, 1);
insert into t values (2, 2);
insert into t values (3, 3);
commit;

set term ^;

execute block returns (id int, val int)
as begin
  for
    execute statement 'select first 10 id, val from t order by val' into :id, :val
  do begin
    delete from t where id = 3;
  end

  suspend;
end^

set term ;^

Statement failed, SQLSTATE = 22000 no current record for fetch operation -At block line: 6, col: 5