I\'m using Firebird Embedded v2.5. How to use procedures in query (SELECT) ?
My procedure:
SET TERM ^ ;
CREAT
FN_TEST
is an executable procedure: it can be called via the EXECUTE PROCEDURE
statement and it returns a single set of output parameters.
In Firebird 2.x only a selectable stored procedure can be "used" as a view / table (see Firebird Stored Procedures).
So:
SELECT FN_TEST(some_table_field) AS field_modified
FROM tb_test
produces an invalid request BLR at offset... error.
You could change your procedure as suggested but, actually, the feature you need has been introduced in Firebird 3 in the form of stored function:
CREATE FUNCTION FN_TEST(Y INT) RETURNS INT
AS
BEGIN
RETURN Y + 1;
END;
SELECT FN_TEST(4) AS zzz
FROM tb_test
Further details in Functions with PSQL in Firebird 3.
Use UDF in order to manage calculation on fields. Stored procedure are admited only in the FROM Clause.