Nonstop Database, HiRDB Version 9 UAP Development Guide

[Contents][Index][Back][Next]

4.19.1 About sequence generators

A sequence generator generates one consecutive number (sequential number) at a time regardless of user or transaction status. The following figure provides an overview of a sequence generator.

Figure 4-75 Overview of a sequence generator

[Figure]

Explanation:
The NEXT VALUE expression is used to acquire a sequential number generated by the sequence generator. This expression acquires the value that immediately follows the most recent value (current value) generated by the sequence generator, and then updates the current value to that value.
If the NEXT VALUE expression has not yet been used since the sequence generator was defined, no current value is set. When the NEXT VALUE expression is used while no current value is set, the sequence generator's start value is returned and that value is stored as the current value.
Note
The current value is not recovered during a rollback. The next number in sequence is always generated regardless of the transaction's status.