GEN_ID()

<< FLOOR() | FB 2.5 Language Reference | GEN_UUID() >>
<< FLOOR() | FB 2.1 Language Reference | GEN_UUID() >>
<< EXTRACT() | FB 2.0 Language Reference | IIF() >>

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.

See also:
NEXT VALUE FOR
CREATE GENERATOR
SET GENERATOR
Firebird Null Guide: Internal functions and directives

back to top of page
<< FLOOR() | FB 2.5 Language Reference | GEN_UUID() >>
<< FLOOR() | FB 2.1 Language Reference | GEN_UUID() >>
<< EXTRACT() | FB 2.0 Language Reference | IIF() >>