Subject Re: SPs and recursion
Author duilio_fos <irel_llc@libero.it>
Svein,

>WayBack(5) naturally calls WayBack(5)

this is clear now.

>Change your code to call fm_sol before calling WayBack and your
code will work.

After many trial, I got this code that actually works:

CREATE PROCEDURE WayBack(sol integer)
RETURNS
(result integer)
AS
declare variable i integer;
BEGIN
result=:sol;
suspend;
if (:sol = 0) THEN
exit;
select fm_sol from a_dep where to_sol=:sol into :result;
for select result from WayBack(:result) into :result do
begin
suspend;
end
END

Thank you

Duilio