Examples

A possible reason for specifying RESTART without a numeric value would be to reset the sequence to the START WITH value. In this example, the goal is to generate the numbers from 1 up to the number of rows in a table and then inserting the numbers into a column added to the table using temporary tables.

  ALTER SEQUENCE ORG_SEQ
    RESTART

  DECLARE GLOBAL TEMPORARY TABLE TEMP_ORG AS
    (SELECT NEXT VALUE FOR ORG_SEQ, ORG.*
    FROM ORG) WITH DATA

Another use would be to get results back where all the resulting rows are numbered:

  ALTER SEQUENCE ORG_SEQ
    RESTART

  SELECT NEXT VALUE FOR ORG_SEQ, ORG.*
    FROM ORG