NEXT VALUE FOR

<< IS [NOT] DISTINCT FROM | FB 2.5 Language Reference | SIMILAR TO >>
<< IS [NOT] DISTINCT FROM | FB 2.1 Language Reference | SOME >>
<< IS [NOT] DISTINCT FROM | FB 2.0 Language Reference | SOME >>

NEXT VALUE FOR

Available in: DSQL, PSQL

Added in: 2.0

Description

Returns the next value in a sequence. SEQUENCE is the SQL-compliant term for what InterBase and Firebird have always called a generator. NEXT VALUE FOR is fully equivalent to GEN_ID(..., 1) and is the recommended syntax from Firebird 2.0 onward.

Syntax

 NEXT VALUE FOR sequence-name

Example

 new.cust_id = next value for custseq;

NEXT VALUE FOR doesn't support increment values other than 1. If you absolutely need other step values, use the legacy GEN_ID function.

See also:
GEN_ID()
CREATE SEQUENCE
ALTER SEQUENCE
DROP SEQUENCE

back to top of page
<< IS [NOT] DISTINCT FROM | FB 2.5 Language Reference | SIMILAR TO >>
<< IS [NOT] DISTINCT FROM | FB 2.1 Language Reference | SOME >>
<< IS [NOT] DISTINCT FROM | FB 2.0 Language Reference | SOME >>