Sample cases of specifying sequences

The following are some sample cases of specifying sequences.
  • To create a sequence that produces values 1 - 100 in order and the 101st “next value for” results in an error:
    CREATE SEQUENCE sequence1 as integer
    START WITH 1 increment by 1
    minvalue 1 maxvalue 100 no cycle
  • To create a sequence that generates odd values 11 - 99 then cycles and starts again at the minvalue 1. The sequence does not restart at the starting value.
    CREATE SEQUENCE sequence2 as integer
    START WITH 11 increment by 2
    minvalue 1 maxvalue 100 cycle
  • To create a sequence that decreases by 10 and then cycles. The first and second passes return different sets of values: 93, 83,73 …100, 90, 80 … 10, 100.
    CREATE SEQUENCE sequence3 as integer
    START WITH 93 increment by -10
    minvalue 1 maxvalue 100 cycle