Subject Re: [firebird-support] How to call a SP in another SP both with return parameters
Author Lucas Franzen
flipmooooo schrieb:
>
> Hi,
>
> How do i call a SP in another SP both with return parameters.
> in SP1 i need to do something like this but i don't know the right
> syntax: ERRORTEXT = EXECUTE PROCEDURE SP2(AID);
>
> Greetings,
> Filip Moons
>
>
> CREATE PROCEDURE SP1 (ID INTEGER) RETURNS (ERRORTEXT VARCHAR(40))
>
> CREATE PROCEDURE SP2 (ID INTEGER) RETURNS (ERRORTEXT VARCHAR(40))

That depends if the stored proc is an executable or a selectable one.

For an executable one:

EXECUTE PROCEDURE <procname> (in_params)
RETURNING_VALUES <out_params>

For a selectable one:
(FOR) SELECT <fieldlist>
FROM <procname (in_params)
INTO <variables>

In the first case you have to supply a variable for every param that's
returned by the procedure,

in the second case you can select just some of the fields the procedure
returns and have just have to supply just one variable for every return
field (param).


Luc.