Nonstop Database, HiRDB Version 9 Description

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

5.13 Automatic numbering facility

The automatic numbering facility returns a serial integer every time data is retrieved from a database. This facility can be used when you define a sequence generator. Using the automatic numbering facility improves the development efficiency of the UAP that performs numbering. Furthermore, the portability from UAPs created by other DBMSs that support a sequence generator also improves. Therefore, we recommend that you use the automatic numbering facility to number jobs.

A sequence generator generates a contiguous number (sequential number) each time regardless of the status of the user or transaction. The following figure provides an overview of a sequence generator.

Figure 5-14 Overview of a sequence generator

[Figure]

Explanation
To acquire the sequential numbers generated by the sequence generator, you use the NEXT VALUE expression. This expression acquires the value that comes after the latest value (current value) generated by the sequence generator and updates the current value to the acquired value.
If the NEXT VALUE expression is not used at all after the sequence generator is defined, the current value remains unset. If the NEXT VALUE expression is used while the current value is unset, the start value of the sequence generator is returned and this value is stored as the current value.
Note
The current value is not recovered even if a rollback occurs. Contiguous numbers are generated regardless of the transaction status.
For details about the automatic numbering facility, see the HiRDB Version 9 UAP Development Guide.