Subject Re: [ib-support] Re: SPs and recursion
Author Svein Erling Tysvaer
At 22:06 20.02.2003 +0000, you wrote:
>CREATE PROCEDURE WayBack(sol integer)
>RETURNS
> (result integer)
>AS
>BEGIN
> if (:sol = 0) THEN
> begin
> result = 0;
> suspend;
> exit;
> end
> for select result from WayBack(:sol) into :result
> do
> begin
> suspend;
> select fm_sol from a_dep where to_sol=:result into :sol;
> end
>END
>
>However, this code seems to fall into a never ending loop, as I get
>the error message:

Duilio,
of course this results in a never ending loop. E.g. let's say you call
WayBack(5). What is the first thing WayBack then does? Call WayBack(5). And
WayBack(5) naturally calls WayBack(5). Change your code to call fm_sol
before calling WayBack and your code will work.

Set