GEN_ID()

Available in: DSQL, ESQL, PSQL

Added in: IB

Description: Increments a generator or sequence and returns its new value. From Firebird 2.0
onward, the SQL-compliant NEXT VALUE FOR syntax is preferred, except
when an increment other than 1 is needed.

Result type: BIGINT

Syntax:

GEN_ID (generator-name, <step>)
<step> ::= An integer expression.

Example:

new.rec_id = gen_id(gen_recnum, 1);

Warning

Unless you know very well what you are doing, using GEN_ID() with
step values lower than 1 may compromise your data's integrity.