Subject something very strange going on here
Author martinknappe
hi
i had decided not to bother you any more with my "how do i speed this
up" question but now something very strange ocurred and i really need
to ask if someone has an explanation for it:

my procedure is and was correct; when i execute it in the ibexpert
debugger, I get correct results..but when i execute it outside the
debugger(sql editor), i get incorrect results

the procedure is:

CREATE PROCEDURE TEST (
asterm_in varchar(240),
id_in bigint)
returns (
id_out bigint,
pos integer)
as
declare variable id_temp bigint;
declare variable asterm_temp varchar(240) character set unicode_fss;
begin
pos = 0;
id_temp = :id_in;
asterm_temp = :asterm_in;
while (1 = 1) do
begin
select min(asterm) from dicentries where ((asterm = :asterm_temp
and id >= :id_temp)) or (asterm > :asterm_temp) into :asterm_temp;
if (asterm_temp is null) then
exit;
select min(id) from dicentries where asterm = :asterm_temp into
:id_out;
suspend;
pos = pos + 1;
id_temp = :id_out + 1;
if (:pos = 20) then
exit;
end
end

in debugger (asterm_in = 'A', id_in = 0):

id_out pos

142 0
107 1
150 2
147 3
164 4
95 5
41 6
93 7
18 8
23 9
187 10
14 11
188 12
189 13
15 14
12 15
27 16
31 17
32 18
36 19


in sql-editor (same parameters):

id_out pos

142 0
107 1
150 2
147 3
164 4
<null> 5
41 6
93 7
18 8
23 9
187 10
14 11
188 12
<null> 13
15 14
12 15
27 16
31 17
32 18
<null> 19

Isn't that strange?

Martin