Sequence Functions

Sequence functions in TiDB are used to return or set values of sequence objects created using the CREATE SEQUENCE statement.

Function nameFeature description
NEXTVAL() or NEXT VALUE FORReturns the next value of a sequence
SETVAL()Sets the current value of a sequence
LASTVAL()Returns the last used value of a sequence

MySQL compatibility

MySQL does not support the functions and statements for creating and manipulating sequences as defined in ISO/IEC 9075-2.