Subject Re: [firebird-support] How to call a STORED PROCEDURE in SQL statement : select ProcA(col1) from ...
Author Martijn Tonies
Hi there,

> 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?

Because a PROCEDURE it's not a FUNCTION.

>Will FIREBIRD V2 remove this limitation?

No, because a PROCEDURE it's not a FUNCTION.

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

If the procedure is select-able (has SUSPEND in it), you can do:

select col1, col2, (select myoutputparam from ProcA(col3))
from tableA

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

Not if your UDF needs access to your tables/views/etc...

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Upscene Productions
Database development questions? Check the forum!