ALTER SEQUENCE statement


The ALTER SEQUENCE statement defines changes to a sequence definition.

GUID-6AB49C91-2E6A-44A6-9DB1-10186CC59CBF-low.png

ALTER SEQUENCE schema 1. sequenceName 1

This option specifies the sequence to be changed.

SCHEMA schema 2

This option specifies the new schema for the sequence.

NAME sequenceName 2

This option specifies the new name of the sequence.

TYPESCHEMA dataTypeSchema

This option specifies the schema for the sequence data type.

TYPENAME dataTypeName

This option specifies the name of the sequence data type.

LENGTH numeric

For sequences that are defined as a DECIMAL data type, this option specifies the length of the value.

START numeric

This option specifies the starting value for the sequence. The default value is the minimum value for an ascending sequence or the maximum value for a descending sequence.

INCREMENT numeric

This option specifies the amount of change in the values for the sequence. The value can be any positive or negative integer, including 0 (zero). The default value is 1.

MINVALUE

This option specifies the minimum value for a sequence. The minimum value can be equal to or less than the maximum value.

MINVALUE parameter values

Value

Description

Numeric

Specifies the minimum value

<DEFLT>

Specifies a default value for the minimum value

If the sequence is descending, <DEFLT> is the smallest value allowed. If the sequence is ascending, the value is either the starting value or 1 if the starting value is not specified. <DEFLT> is the equivalent of NOMINVALUE.

MAXVALUE

This option specifies the maximum value for a sequence. The maximum value can be equal to or greater than the minimum value.

MAXVALUE parameter values

Value

Description

Numeric

Specifies the maximum value

<DEFLT>

Specifies a default value for the maximum value

If the sequence is ascending, <DEFLT> is the largest value allowed. If the column is descending, the default value is either the starting value or -1 if the starting value is not specified. <DEFLT> is the equivalent of NOMAXVALUE.

CYCLE

This option indicates whether values should be generated after the maximum or minimum value is reached.

CYCLE parameter values

Value

Description

NO

Indicates that values should not be generated after the maximum or minimum value is reached

CYCLE NO is the default.

YES

Indicates that values should be generated after the maximum or minimum value is reached

CACHE integer

This option specifies the number of a set of values that are stored for the sequence. A value of 0 (zero) is the equivalent of NO CACHE.

ORDER

This option indicates whether values must be generated in the order in which they are requested. The following table lists valid values for the ORDER parameter.

ORDER parameter values

Value

Description

NO

Indicates that values should not be generated in the order in which they are requested

ORDER NO is the default.

YES

Indicates that values must be generated in the order in which they are requested

COMMENT 'string'

This option specifies the comment for the sequence.

Related topic


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*