NEXT STAMP Statement (next_stamp_statement)

The NEXT STAMP statement (next_stamp_statement) supplies a unique key that was generated by the database system.


<next_stamp_statement> ::= NEXT STAMP [INTO] <parameter_name>


The database system is able to generate unique values. Such values are serial numbers beginning at X'0000000000001' and are assigned in ascending order. It cannot be ensured that a sequence of values is uninterrupted. These values can be stored in a column with the data type CHAR(n) BYTE with n>=8.

The NEXT STAMP statement assigns the next key generated by the database system to the variable denoted by parameter name.

The NEXT STAMP statement can only be embedded in a programming language and cannot be used in interactive mode.

The keyword STAMP can be also used in an INSERT statement or an UPDATE statement if the next value is to be generated by the database system and stored in a column without the user knowing the value.