Show TOC

ALTER SEQUENCE statementLocate this document in the navigation structure

Alters a sequence. This statement applies to SAP IQ catalog store tables only.

Syntax
ALTER SEQUENCE [<owner>.]<sequence-name>
[ RESTART WITH <signed-integer> ]
[ INCREMENT BY <signed-integer> ]
[ MINVALUE <signed-integer> | NO MINVALUE ]
[ MAXVALUE <signed-integer> | NO MAXVALUE ]
[ CACHE <integer> | NO CACHE ]
[ CYCLE | NO CYCLE ]
Parameters
  • RESTART WITH clause

    Restarts the named sequence with the specified value.

  • INCREMENT BY clause

    Defines the amount the next sequence value is incremented from the last value assigned. The default is 1. Specify a negative value to generate a descending sequence. An error is returned if the INCREMENT BY value is 0.

  • MINVALUE clause

    Defines the smallest value generated by the sequence. The default is 1. An error is returned if MINVALUE is greater than ( 2^63-1) or less than -(2^63-1). An error is also returned if MINVALUE is greater than MAXVALUE.

  • MAXVALUE clause

    Defines the largest value generated by the sequence. The default is 2^63-1. An error is returned if MAXVALUE is greater than 2^63-1 or less than -(2^63-1).

  • CACHE clause

    Specifies the number of preallocated sequence values that are kept in memory for faster access. When the cache is exhausted, the sequence cache is repopulated and a corresponding entry is written to the transaction log. At checkpoint time, the current value of the cache is forwarded to the ISYSSEQUENCE system table. The default is 100.

  • CYCLE clause

    Specifies whether values should continue to be generated after the maximum or minimum value is reached.

Remarks

If the named sequence cannot be located, an error message is returned.

Privileges

You must be the owner of the sequence, or have one of the following privileges:

  • ALTER ANY SEQUENCE system privilege
  • ALTER ANY OBJECT system privilege
Side effects

None

Standards
  • SQL/2008

    The ALTER SEQUENCE statement is part of optional SQL language feature T176 of the SQL/2008 standard. The CACHE clause is a vendor extension.

Example

Example

The following example sets a new maximum value for a sequence named Test:

ALTER SEQUENCE Test 
   MAXVALUE 1500;