Example 1: Altering a sequence
SQL> -- Show current sequence definition:
SQL> --
SQL> SHOW SEQUENCE EMPIDS
EMPIDS
Sequence Id: 1
Initial Value: 1
Minimum Value: 1
Maximum Value: 9223372036854775787
Next Sequence Value: 1
Increment by: 1
Cache Size: 20
No Order
No Cycle
No Randomize
SQL> --
SQL> -- Alter the sequence.
SQL> --
SQL> ALTER SEQUENCE EMPIDS
cont> MINVALUE 0
cont> MAXVALUE 2000
cont> CACHE 30
cont> ORDER
cont> CYCLE;
SQL> --
SQL> -- Show new definition.
SQL> --
SQL> SHOW SEQUENCE EMPIDS
EMPIDS
Sequence Id: 1
Initial Value: 1
Minimum Value: (none)
Maximum Value: 2000
Next Sequence Value: 1
Increment by: 1
Cache Size: 30
Order
Cycle
No Randomize
Example 2: Reset the sequence to a specified value
SQL> show sequence NEW_EMPLOYEE_ID
NEW_EMPLOYEE_ID
Sequence Id: 1
Initial Value: 472
.
.
.
SQL>
SQL> alter sequence NEW_EMPLOYEE_ID
cont> restart with 500;
SQL>
SQL> show sequence NEW_EMPLOYEE_ID
NEW_EMPLOYEE_ID
Sequence Id: 1
Initial Value: 500
.
.
.
SQL>