Subject Re: [firebird-support] How to return a IDENTITY field before insert it?
Author Mark Rotteveel
On 2018-02-14 18:32, Elton Fadel galdarius3@...
[firebird-support] wrote:
> I don't know why identity is better then the old method, but if we
> can't have access to the next number, this can be useless in some
> cases.
> How to get it like we did on FB 2.5 with a procedure to get the next
> ID of a generator?

I can't think of any reason why you would ever need to get the value of
an identity column before the insert. The whole point of an identity
column is to generate the value on insert without using other tricks.
Just use INSERT (<non-id-columns>) values (...) RETURNING <id-column> to
get the value as generated on insert.

If you do have a use case, then that is a case where you should not use
an identity column at all, but instead you should use a plain sequence