Subject RE: [ib-support] Determining generator's current value
Author Rado Benc
Hi Don,

> Using the standard trigger/generator method to create a unique primary key
> value for a newly inserted record, is there a way to determine the primary
> key/generator value of the record I have just inserted? I want to
> insert the
> new record using a stored proc. and then use the primary key's value to do
> further processing within the same stored proc.

If I understand it correctly you need something like:

CREATE PROCEDURE GET_NEW_ACCOUNT_NO
RETURNS
(
AVALUE INTEGER
)
AS
BEGIN
AVALUE = GEN_ID(GEN_ACCOUNT_NO, 0);
END;

Note that GEN_ID(GEN_FOO, 0) does not increase the
value of GEN_FOO.

HTH,

Rado