Subject Re: [firebird-support] Get Gen_ID value used in last INSERT INTO
Author Lester Caine
Diego Barros wrote:

> When I insert a new row into a table, and one of the field's uses a
> generator, how can I get that value of that generated field? Do I need
> to write a stored procedure to do this? Something like:
> ID = GEN_ID('xx', 1);
> INSERT INTO Table... (using ID)
> return ID
> Or is there something along the lines of SQL Server's "SELECT

Reading between the lines - I think you want to know the ID for other
reasons than just entering the data.
The easiest way of doing this is to get the value first, and then use it
in the insert(s)

Returns a generator number that you can then use.

At present there is no way to 'return' anything after an insert, but
this is the proper way to do it anyway. Just call the generator SELECT
once you know you need to INSERT.

Lester Caine
L.S.Caine Electronic Services