Subject Re: [firebird-support] Generators and Stored Procedures
Author Ivan Prenosil
CREATE OR ALTER PROCEDURE G (GNAME VARCHAR(31))
RETURNS (GVAL BIGINT) AS
BEGIN
EXECUTE STATEMENT 'SELECT GEN_ID(' || UPPER(:GNAME) || ', 1) FROM RDB$DATABASE' INTO :GVAL;
END

Ivan
http://www.volny.cz/iprenosil/interbase/

----- Original Message -----
From: <buppcpp@...>
To: <firebird-support@yahoogroups.com>
Sent: Friday, June 17, 2005 8:38 AM
Subject: [firebird-support] Generators and Stored Procedures


> I'm having a heck of a time getting generators to work within a SP using FB
> SS 1.5.2.
>
> I'm I correct in assuming that you can not call a generator from within a SP
> if you are using variables?
>
> ex.
> gen_value = GEN_ID ( :gen_name, :gen_increment);
>
> It doesn't work as DSQL within a SP either when you use EXECUTE STATEMENT.
>
> I think it has to do with variables.
>
> Please tell me I'm wrong, and put me back on the correct path.
>
> Thanks