Subject Re: [firebird-support] Procedure as Function calling
Author Martijn Tonies
> I have question. I have procedure, for example:
>
> CREATE PROCEDURE SQR(X INTEGER) RETURNS(RESULT INTEGER) AS
> begin
> Result=:x*:x;
> suspend;
> end
>
> I also have table or tables
>
> CREATE TABLE T (
> ID INTEGER,
> VAL INTEGER
> )
>
> Is it possible to call my procedure as function (Informix supports
> this syntax):
>
> select sqr(T.Val) from T where ID=2;
>
> An error was found in the application program input parameters for
> the SQL statement.
> Dynamic SQL Error.
> SQL error code = -804.
> Function unknown.
> SQR.
>
> Currently I use:
>
> select (select * from sqr(T.Val)) from T where ID=2;
>
> Is it the only way to do this? And what about future version?

A future version should have Stored Functions.

Heck, I have no idea why v2 doesn't have it :-(

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com