'
Please consider following script:
========
set bail on;
shell if exist r:\temp\tmp4test.fdb del r:\temp\tmp4test.fdb;
create database 'localhost:r:\temp\tmp4test.fdb' user 'sysdba' password 'masterkey';
set list on;
set autoterm on;
recreate table ltt_test(txt varchar(10));
--recreate local temporary table ltt_test(txt varchar(10)) on commit preserve rows;
--recreate global temporary table ltt_test(txt varchar(10)) on commit preserve rows;
execute block returns(cnt int) as
declare temporary table ltt_test(txt varchar(10)); ------------ [ 1 ]
begin
insert into ltt_test(txt) values('foo');
for
select txt
from ltt_test
as cursor c
do begin
select 1 from ltt_test u
where u.txt= c.txt
order by 1 ------------------------------------------------ [ 2 ]
rows 1
into cnt;
suspend;
end
end;
========
It will issue error:
========
Statement failed, SQLSTATE = 22000
no current record for fetch operation
-At block line: 13, col: 9
========
Now let's comment out statements marked as either [ 1 ] or [ 2 ] and repeat.
Script will complete OK and issue:
CNT 1
(and same if we try with global or local temporary tables; only DECLARED temp table is affected).
Checked on 20260829_024127-6.0.0.2164-2d371e2.