Subject Re: [ib-support] Re: Getting id of last inserted record
Author Lucas Franzen
David,


seems my answer is lost somewhere in cyberspace....

> INSERT INTO table1 (col2, col3) VALUES (col2Val, col3Val)
>
> and the call returns the id of the newly created row.
>
> Is one possiblity locking the table for writing? That would mean
> the trigger couldn't get called before I call the
>
> SELECT GEN_ID(GEN_ATABLE, 0) FROM RDB$DATABASE;

use:
SELECT GEN_ID(GEN_ATABLE, 1) FROM RDB$DATABASE;

to get the next generator value.
That's safe (since it's equivalent to GEN_ID ( GEN_ATABLE, 1 ) in a
trigger)

Luc.