For details, please click: http://www.verydemo.com/demo_c158_i78137.html
1) Build sequence command
CREATE SEQUENCE [user.]sequence_name
[increment by n]
[start with n]
[maxvalue n | nomaxvalue]
[minvalue n | nominvalue];
INCREMENT BY: Specifies the interval between sequence numbers, which can be positive or negative Integer, but not 0. The sequence is ascending. When this clause is omitted, the default value is 1.
START WITH: Specifies the first serial number generated. In ascending order, the sequence can start with a value greater than the minimum value, which defaults to the minimum value of the sequence. For descending order, the sequence can start with a value less than the maximum value, which defaults to the maximum value of the sequence.
MAXVALUE: Specifies the maximum value that the sequence can generate.
NOMAXVALUE: Specify a maximum value of 1027 for ascending order and -1 for descending order.
MINVALUE: Specifies the minimum value of the sequence.
NOMINVALUE: Specifies a minimum value of 1 for ascending order. Specify a minimum value of -1026 for descending order.
2) Change the sequence command
ALTERSEQUENCE [user.]sequence_name
[INCREMENT BY n]
[MAXVALUE n| NOMAXVALUE ]
[MINVALUE n | NOMINVALUE];
Modifying a sequence can:
? Modify the increment of future sequence values.
• Set or undo the minimum or maximum value.
• Change the number of buffer sequences.
• Specifies whether serial numbers are ordered.
3) Delete sequence command
....................................................................
A statement to create a serial number:
The usage of serial number in PB: