ORDER in CREATE SEQUENCE - Oracle to MariaDB Migration

In Oracle you can specify the ORDER option in CREATE SEQUENCE statement to guarantee that sequence numbers are generated in order of request. Note that this option has relevance to Oracle RAC databases only:

Oracle:

  CREATE SEQUENCE sales_seq
    ORDER;
  -- Sequence created.

MariaDB does not support the ORDER option:

MariaDB:

   CREATE SEQUENCE sales_seq
    ORDER;
  # SQL Error (1064): You have an error in your SQL syntax; check the manual that 
  # corresponds to your MariaDB server version for the right syntax to use near 'ORDER' at line 2 
 
  -- Trying without ORDER option now
  CREATE SEQUENCE sales_seq;
  -- Ok

The ORDER option is usually not required if you use a sequence to generate IDs (surrogate keys).

When converting sequences from Oracle to MariaDB, SQLines SQL Converter tool comments the ORDER clause and puts a warning to the conversion report.

Note that sequences are available since MariaDB 10.3

For more information, see: