The sequence generator is a service that generates a sequence of integer numbers.
sequence_generator_attributes ::= (START WITH signed_int) | (INCREMENT BY signed_int) | (MAXVALUE signed_int) | (NO MAXVALUE) | (MINVALUE signed_int) | (NO MINVALUE) | (CACHE INT) | (NO CACHE) | CYCLE | (NO CYCLE)
Oracle NoSQL Database only supports sequence generators that are attached to identity columns. See Using the IDENTITY Column.The numbers in the generated sequence depend on the attributes of the sequence generator attributes. The following attributes are supported:
- START WITH
The first number in the sequence. The default is 1.
- INCREMENT BY
The next number in the sequence is generated by adding INCREMENT BY value to the current value of the sequence. The increment value can be a positive number or a negative number. Sequence generator having a positive increment is ascending and a sequence generator having a negative increment is descending. The default is 1. The value 0 is invalid.
- MINVALUE or NO MINVALUE
The lower bound of the sequence range. The default is -2^31 which is the minimum value of the integer datatype.
- MAXVALUE or NO MAXVALUE
The upper bound of the sequence range. The default 2^31-1 which is the maximum value of the integer datatype.
- CYCLE or NO CYCLE
Specify this to indicate that the sequence continues to generate values after reaching either its maximum or minimum value. After an ascending sequence reaches its maximum value, it generates its minimum value. After a descending sequence reaches its minimum, it generates its maximum value.
The value of this attribute is the number of sequence numbers that will be generated every time a request is made to the sequence generator. These requests originate at the Oracle NoSQL Database clients and are serviced by the sequence generator, which "lives" at the server. Specifically, the numbers generated in each request are sent back to the client and are cached there. Whenever a client needs to assign a value to an identity column, the next sequence number from the cache is consumed. When cache empties, a request for another batch of CACHE sequence numbers is sent to the sequence generator. The default CACHE size is 1000.