Subject Re: How to call a STORED PROCEDURE in SQL statement : select ProcA(col1) from ..
Author Adam
> Firebird STORED PROCEDUREs cannot be called directly in the SELECT
> part of a SQL statement.
>
> For example, a procedure ProcA(arg1) that returns an integer, cannot
> be called in the follwing way:
>
> select col1, col2, ProcA(col3) from tableA; -- INVALID
>
> I find this a real limitation. What is the reason for such a
> behaviour?

ProcA may return more than one record depending on how many times
suspend is called internally. What should it do in that case? Which of
the output parameters should be used if multiple are provided? (I
assume Col3 is an input parameter).

> Will FIREBIRD V2 remove this limitation?
>

No

> Is there a workaround in V1.5.x based only on the SELECT syntax?
>

Yes

select col1, col2, (select first 1 someoutputparameter from ProcA(col3))
from tableA

> If not, is an UDF (with low portability between OS) the only possibilty?
>

UDFs can not make database connections. OK I lie, they **can**, but
never do that! It does not work.

Adam