SERIAL8(n) data type

The SERIAL8 data type stores a sequential integer, of the INT8 data type, that is assigned automatically by the database server when a new row is inserted.

The SERIAL8 data type behaves like the SERIAL data type, but with a larger range. For more information about how to insert values into SERIAL8 columns, see the HCL OneDB™ Guide to SQL: Syntax.

A SERIAL8 data column is commonly used to store large, unique numeric codes such as order, invoice, or customer numbers. SERIAL8 data values have the same precision and storage requirements as INT8 values (page INT8).

The default serial starting number is 1, but you can assign an initial value, n, when you create or alter the table.
  • You must specify a positive number for the starting number.
  • If you specify zero (0) for the starting number, the value that is used is the maximum positive value that already exists in the SERIAL8 column + 1.

A table can have no more than one SERIAL column, but it can have a SERIAL column and either a SERIAL8 column or a BIGSERIAL column.

SERIAL8 values in a column are not automatically unique. You must apply a unique index or primary key constraint to this column to prevent duplicate serial numbers. If you use the interactive schema editor in DB-Access to define the table, a unique index is applied automatically to a SERIAL8 column.

SERIAL8 numbers might not be consecutive, because of concurrent users, rollbacks, and other factors.

The DEFINE variable LIKE column syntax of SPL for indirect typing declares a variable of the INTEGER data type if column is a SERIAL8 data type.

For more information, see Assigning a Starting Value for SERIAL8. For information about using the SERIAL8 data type with the INT8 or BIGINT data type, see Using SERIAL8 and BIGSERIAL with INT8 or BIGINT