SEQUENCE Functions
Learn about sequence functions in MariaDB Server. This section details SQL functions for retrieving the next or current value from a sequence, crucial for generating unique identifiers.
Last updated
Was this helpful?
Learn about sequence functions in MariaDB Server. This section details SQL functions for retrieving the next or current value from a sequence, crucial for generating unique identifiers.
LASTVAL is a synonym for PREVIOUS VALUE FOR, returning the most recent value generated from a sequence in the current connection.
Generate the next value of a sequence with NEXT VALUE FOR (ANSI SQL), NEXTVAL() (PostgreSQL), or sequence_name.nextval in Oracle mode.
NEXTVAL is a synonym for NEXT VALUE FOR, generating the next value of a sequence.
Get the most recent value generated from a sequence in the current connection with PREVIOUS VALUE FOR (DB2), LASTVAL() (PostgreSQL), or sequence_name.currval in Oracle mode.
Set the next value returned by a sequence with SETVAL(), a PostgreSQL-compatible function extended with is_used and round arguments that never lowers the sequence below its current value.
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?
Was this helpful?

