Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

ALTER SEQUENCE

Syntax

ALTER SEQUENCE sequence_name
[ INCREMENT BY increment_value ]
[ MAXVALUE max_value | NOMAXVALUE ]
[ MINVALUE min_value | NOMINVALUE ]
[ CYCLE | NOCYCLE ]

Description

ALTER SEQUENCE is a SQL command used to alter one or more characteristics of a sequence.

  • sequence_name is the name of the sequence that is to be modified.
  • increment_value specifies a new increment by value to be associated with the sequence.
  • max_value specifies a new maximum value to be associated with the sequence.
  • min_value specifies a new minimum value to be associated with the sequence.
  • cycle specifies if the sequence should cycle or not.

Note that it is possible to put the sequence into a state from which no further values can be returned through the use of the alter command. For example, if the new max_value is less than the current value of the sequence for an ascending sequence, or if the new increment_value would make the next value be outside of the sequence bounds.

Return Values

Error Code

Message

Returned By

-20266

Sequence cannot be used here

DROP SEQUENCE
ALTER SEQUENCE

-20267

Sequence not found

DROP SEQUENCE
ALTER SEQUENCE

-20268

START-WITH/CURRENT-VALUE cannot be greater than MAXVALUE

CREATE SEQUENCE
ALTER SEQUENCE

-20269

START-WITH/CURRENT-VALUE cannot be less than MINVALUE

CREATE SEQUENCE
ALTER SEQUENCE

-20270

Invalid sequence MINVALUE specified

CREATE SEQUENCE
ALTER SEQUENCE

-20271

Invalid sequence INCREMENT specified

CREATE SEQUENCE
ALTER SEQUENCE

-20272

START-WITH cannot be altered in sequence

CREATE SEQUENCE
ALTER SEQUENCE

-20273

No options specified for ALTER SEQUENCE

CREATE SEQUENCE
ALTER SEQUENCE

-20274

Sequence increment has exceeded MAXVALUE

CREATE SEQUENCE
ALTER SEQUENCE

-20275

Sequence decrement has exceeded MINVALUE

CREATE SEQUENCE
ALTER SEQUENCE

-20276

Only SELECT and ALTER privileges are valid for sequences

CREATE SEQUENCE
ALTER SEQUENCE

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

See Also

TOCIndex