Oracle7 Server SQL Reference
ALTER SEQUENCE
Purpose
To change the sequence in one of these ways:
- changing the increment between future sequence values
- setting or eliminating the minimum or maximum value
- changing the number of cached sequence numbers
- specifying whether sequence numbers must be ordered
Prerequisites
The sequence must be in your own schema or you must have ALTER privilege on the sequence or you must have ALTER ANY SEQUENCE system privilege.
If you are using Trusted Oracle7 in DBMS MAC mode, your DBMS label must match the sequence's creation label or you must satisfy one of these criteria:
- If the sequence's creation label is higher than your DBMS label, you must have READUP and WRITEUP system privileges
- If the sequence's creation label is lower than your DBMS label, you must have WRITEDOWN system privilege.
- If the sequence's creation label and your DBMS label are not comparable, you must have READUP, WRITEUP, and WRITEDOWN system privileges.
Syntax
Keywords and Parameters
The keywords and parameters in this command serve the same purpose that they do in the CREATE SEQUENCE command .
Usage Notes
The sequence must be dropped and recreated to restart the sequence at a different number. Only future sequence numbers are affected by the ALTER SEQUENCE command.
Some validations are performed. For example, a new MAXVALUE cannot be imposed that is less than the current sequence number.
Example I
This statement sets a new maximum value for the ESEQ sequence:
ALTER SEQUENCE eseq
MAXVALUE 1500
Example II
This statement turns on CYCLE and CACHE for the ESEQ sequence:
ALTER SEQUENCE eseq
CYCLE
CACHE 5
Related Topics
CREATE SEQUENCE command
DROP SEQUENCE command