Name

sequence_next — Returns the current state of the specified sequence and increments it by one.

Synopsis

integer sequence_next ( in name varchar ,
in increment_by integer );

Description

This function returns the current state of the specified sequence and atomically increments it by one. The next call will thus return a number one greater than the previous. The sequence is shared between all connections and all transactions so an increment that is is made in one of connection will be seen in other connection immediately. Using a sequence never involves locking.

Parameters

name

The server-wide name of a sequence.

increment_by

This is to specify how much will be added to the sequence (must be greater than zero) If not specified defaults to 1.

Return Types

The function returns integer