Subject Re: [firebird-support] Using PSQL as a function?
Author Thomas Steinmaurer
> I checked the FB Book but can't see anything obvious.
>
> Is it possible to use PSQL procedures as functions in SQL? Assuming the
> procedure only returns one value, and it's type matches as required,
> something like:
>
> SELECT VAL, MY_PSQL_PROC(VAL) FROM SOME_TABLE;
>
> or
>
> SELECT * FROM SOME_TABLE WHERE VAL = MY_PSQL_PROC(123);
>
> It seems like a useful feature but the only way to do that currently is
> via external C modules.

PSQL-based stored functions are implemented for V3, which is in Alpha
state at the moment, thus not ready for production.

For pre V3, you can use a selectable stored procedure in something
called inline select:

select
t.c1
, (select rvalue from my_psql_proc(t.c1)) as proc_value
from
mytable t


--
With regards,
Thomas Steinmaurer
http://www.upscene.com/

Professional Tools and Services for Firebird
FB TraceManager, IB LogManager, Database Health Check, Tuning etc.