Subject Re: Fwd: trigger that calls procedure
Author tham441
Thanks Helen, it worked perfectly. I got the idea of the flow, now I can proceed with my learning. Thanks again!

--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:

> Remove SUSPEND from the SP.
>
> Then, call the procedure like this if the trigger wants only a one-row set:
> execute procedure proc1 (arg1, arg2, .....)
> returning_values (:var1, :var2, ....)
> /* then do what you want with the vars */
>
> PSQL can't do anything with a multi-row set except step through it, row by row, in a loop. If you want the trigger to use values from a set of multiple rows, determine an end condition and put the EXECUTE PROCEDURE in a WHILE loop controlled by variable:
> ...
> declare variable looper smallint=0;
> ....
> begin
> ....
> /* initialise your args and vars here */
> while (looper = 0) do
> begin
> /* assign values to your args */
> execute procedure proc1 (arg1, arg2, .....)
> returning_values (:var1, :var2, ....)
> if (<end condition>) then
> begin
> looper = 1;
> leave;
> end
> /* do what you want with the vars */
> /* re-initialise the vars */
> end
> ....
> end
> ....
> end
>
> Don't take this as an absolute template for what you want to do, it's just to give you the idea for designing the flow that you need.
>
> ./heLen
>