Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10

ALTER SEQUENCE .. RESTART

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

A sequence can be manually restarted using the RESTART clause, in case of which it will be restarted at the START WITH value.

// Restart the sequence
create.alterSequence("s").restart().execute();

Alternatively, an explicit value can be provide to restart the sequence with:

// Restart the sequence
create.alterSequence("s").restartWith(10).execute();

Dialect support

This example using jOOQ:

alterSequence("s").restart()

Translates to the following dialect specific expressions:

Aurora Postgres, DB2, HSQLDB, MariaDB, Postgres, SQLServer, YugabyteDB

ALTER SEQUENCE s RESTART

Hana, Informix, Vertica

ALTER SEQUENCE s RESTART WITH 1

ASE, Access, Aurora MySQL, BigQuery, ClickHouse, CockroachDB, Derby, DuckDB, Exasol, Firebird, H2, MemSQL, MySQL, Oracle, Redshift, SQLDataWarehouse, SQLite, Snowflake, Sybase, Teradata, Trino

/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo