Loading Values into Serial Columns

You can insert successive numbers or explicit values in a serial column.

About this task

The database server loads serial columns with either the values from the original data file or values that the database server automatically generates.

If you want the serial column values to be the values from the data file, the INSERT statement does not require special handling. If you want the database server to generate the value automatically, omit the serial column from the INSERT statement. For example, if the first column in the table (col1) is the serial column and you use the following statement, the default mechanism provides the serial value:
INSERT INTO mytable (col2, ...) SELECT ...

If the table is being loaded into multiple partitions, the serial values are incremented in the same sequence as the table fragments.