xxxxxxxxxx
CREATE SEQUENCE sequence1
START WITH 1000
INCREMENT BY 1
NOCACHE
NOCYCLE;
xxxxxxxxxx
# Sequence Syntax:
CREATE SEQUENCE sequence_name
[INCREMENT BY increment_value]
[START WITH start_value]
[MAXVALUE max_value | NOMAXVALUE]
[MINVALUE min_value | NOMINVALUE]
[CYCLE | NOCYCLE]
[CACHE cache_size | NOCACHE]
[ORDER | NOORDER];
# Usage Example:
CREATE SEQUENCE customer_id_seq
INCREMENT BY 1
START WITH 1000
MAXVALUE 9999
NOCYCLE
CACHE 50
ORDER;
INCREMENT BY: Default is 1.
CYCLE: the sequence restarts from the beginning once it reaches its maximum or minimum value.
NOCYCLE: the sequence stops generating values once it reaches its maximum value. Default behavior.
CACHE: Specifies the number of sequence numbers to cache in memory for faster access. Default is 20.
NOCACHE: Disables caching of sequence numbers. Each request will be served by the database.
ORDER: Guarantees that sequence values are generated in order of request. Default behavior.