SQL - ALTER SEQUENCE
Changes the sequence. Using this parameter you can change all sequence options, except for the sequence type.
This feature was introduced in version 2.2.
Syntax
ALTER SEQUENCE <sequence> [START <start-point>] [INCREMENT <increment>] [CACHE <cache>] [CYCLE TRUE|FALSE] [LIMIT <limit_value>] [ASC|DESC]
<sequence>
Defines the sequence you want to change.START
Defines the initial sequence value.INCREMENT
Defines the value to increment when it calls.next()
.CACHE
Defines the number of values to cache, in the event that the sequence is of the typeCACHED
.CYCLE
Defines if sequence will restart fromSTART
value afterLIMIT
value reached. Default value isFALSE
.LIMIT
Defines limit value sequence can reach. After limit value is reached cyclic sequences will restart from START value, while non cyclic sequences will throw message that limit is reached.ASC | DESC
Defines order of the sequence.ASC
defines that next sequence value will becurrentValue + incrementValue
, whileDESC
defines that next sequence value will becurrentValue - incrementValue
(assuming that limit is not reached). Default value isASC
.NOLIMIT
Cancel previously definedLIMIT
value
Examples
Alter a sequence, resetting the start value to
1000
:orientdb>
ALTER SEQUENCE idseq START 1000 CYCLE TRUE
For more information, see