Subject Re: something very strange going on here
Author martinknappe
> Try using a separate variable here. IIRC, I've already seen some
> problems when the same variable is used in both WHERE and INTO clauses.

Ok, after I got the other procedure fixed, I'm now having a similar
problem with this procedure (when executed in the debugger,
everything's fine; outside the debugger the procedure seems to somehow
strangely enter an infinite loop (but of course I don't know where):

CREATE PROCEDURE GET_20_DICENTRIES_BY_ASTERM (
"TERM" varchar(240))
returns (
pos integer,
id bigint)
as
declare variable asterm_try varchar(240) character set unicode_fss;
declare variable asterm_temp varchar(240) character set unicode_fss;
begin
pos = 10;
asterm_temp = :term;
while (1 = 1) do
begin
select max(asterm) from dicentries where asterm < :asterm_temp
into :asterm_try;
if (:asterm_try is null) then
break;
for select id from dicentries where asterm = :asterm_try order
by id descending into :id do
begin
suspend;
pos = :pos - 1;
if (:pos = 0) then
break;
end
if (:pos = 0) then
break;
asterm_temp = :asterm_try;
end

pos = 11;
for select id from dicentries where asterm = :term order by id
ascending into :id do
begin
suspend;
pos = :pos + 1;
if (:pos = 20) then
break;
end

asterm_temp = :term;
while (1 = 1) do
begin
select min(asterm) from dicentries where asterm > :asterm_temp
into :asterm_try;
if (:asterm_try is null) then
break;
for select id from dicentries where asterm = :asterm_try order
by id ascending into :id do
begin
suspend;
pos = :pos + 1;
if (:pos = 20) then
break;
end
if (:pos = 20) then
break;
asterm_temp = :asterm_try;
end
end

firebird version is 1.5