Subject | Re: [ib-support] Re: Getting id of last inserted record |
---|---|
Author | Lucas Franzen |
Post date | 2003-04-28T21:24:20Z |
David,
seems my answer is lost somewhere in cyberspace....
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.
seems my answer is lost somewhere in cyberspace....
> INSERT INTO table1 (col2, col3) VALUES (col2Val, col3Val)use:
>
> 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;
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.