Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements >

ALTER SEQUENCE

Use the ALTER SEQUENCE statement to modify the definition of a sequence object.

Only Dynamic Server supports this statement, which is an extension to the ANSI/ISO standard for SQL.

Syntax

Read syntax diagramSkip visual syntax diagram>>-ALTER SEQUENCE--+--------+--sequence------------------------->
                   '-owner.-'
 
   .-------------------------------------------.
   V                                           |
>----+---------------------------------------+-+---------------><
     |    (1)   .-NOCYCLE-.                  |
     +-+--------+-CYCLE---+----+-------------+
     | |  (1)                  |             |
     | +--------+-CACHE size-+-+             |
     | |        '-NOCACHE----' |             |
     | |  (1)   .-ORDER---.    |             |
     | '--------+-NOORDER-+----'             |
     |    (1)              .-BY-.            |
     '-+--------INCREMENT--+----+--step----+-'
       |  (1)            .-WITH-.          |
       +--------RESTART--+------+--restart-+
       |  (1)   .-NOMAXVALUE----.          |
       +--------+-MAXVALUE--max-+----------+
       |  (1)   .-NOMINVALUE----.          |
       '--------+-MINVALUE--min-+----------'
 
Notes:
  1. Use path no more than once
Element Description Restrictions Syntax
max New upper limit on values Must be integer > CURRVAL and restart Literal Number
min New lower limit on values Must be integer < CURRVAL and restart Literal Number
owner Owner of sequence Cannot be changed by this statement Owner Name
restart New first value in sequence Must be integer in the INT8 range Literal Number
sequence Name of existing sequence Must exist. Cannot be a synonym. Identifier
size New number of values to preallocate in memory Integer > 2 but < cardinality of values in one cycle (= |(max - min)/step|) Literal Number
step New interval between successive values Must be a nonzero integer Literal Number

Usage

ALTER SEQUENCE redefines an existing sequence object. It only affects subsequently generated values (and any unused values in the sequence cache).

You cannot use the ALTER SEQUENCE statement to rename a sequence nor to change the owner of a sequence.

You must be the owner, or the DBA, or else have the Alter privilege on the sequence to modify its definition. Only elements of the sequence definition that you specify explicitly in the ALTER SEQUENCE statement are modified. An error occurs if you make contradictory changes, such as specifying both MAXVALUE and NOMAXVALUE, or both the CYCLE and NOCYCLE options.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]