Subject RE: [firebird-support] for select do - statement in nested SP
Author Alan McDonald
> I'm fighting with this since two days....
>
>
> SP1 source code :
>
> begin
> execute procedure SP2 (fills some records into table tmp_table)
>
> for
> select number
> from tmp_table
> into ret_value
> do
> begin
> suspend
> end
> end /* end of SP1 */
>
>
> SP2 source code (simplified) :
>
> begin
> delete from tmp_table
>
> for
> select invoice_number
> from tbl_invoice
> where (some criteria)
> into var_invoice_number
> do
> begin
>
> /* if select statement gives <n> records, this */
> /* "if decision" is for every of this <n> record?? */
> if var_invoice number=(some criteria)then
> begin
> insert into tmp_table(var_invoice_number)
> end
>
> suspend
> end
> end
>
>
> Is it normal, that if there is no (dummy) return value defined for
> SP2, SP2 is writing nothing into tmp_table ???
>
> If I call SP2 directly the expected values are in the tmp_table. If I
> call SP1, the tmp_table is empty.....
>
> Any ideas?
>
> Ulrich

There is no return value for an SP unless you declare one. If you declare
RETURNS, then you need a SUSPEND to return it.
If you do not want a return, then don't declare it AND don't use SUSPEND.
Alan