Subject RE: [firebird-support] A bit strange GEN_ID result
Author Alan McDonald
> In order to get the last inserted id I made this stored as a test:
>
> CREATE PROCEDURE NEW_PROCEDURE
> AS
> declare variable var integer;
> BEGIN
> select max(GEN_ID("Table1_ID_GEN",1)) FROM "Table1" INTO :var;
> insert into "Table1" ("ID") VALUES (:var);
> SUSPEND;
> END
>
this makes no sense
max(generator)???? There's no such thing as a maximum of a single newly
generated value
just select the generator into your var

But really now - why are you wanting the last inserted ID?

Alan