Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 | 

Altering Serials

Description

With the ALTER SERIAL statement, you can update the increment of the serial value, set or delete its initial or minimum/maximum values, and set its cycle attribute.

Syntax

ALTER SERIAL serial_identifier
[ INCREMENT BY interval ]
[ START WITH initial_value ]
[ MINVALUE min | NOMINVALUE ]
[ MAXVALUE max | NOMAXVALUE ]
[ CYCLE | NOCYCLE ]

  • serial_identifier : Specifies the name of the serial to be created.
  • INCREMENT BY interval : Specifies the increment of the serial. For the interval, you can specify any integer with 38 digits or less except for zero. The absolute value of the interval must be smaller than the difference between MAXVALUE and MINVALUE. If a negative number is specified, the serial is in descending order; otherwise, it is in ascending order. The default value is 1.
  • START WITH initial_value : Changes the initial value of Serial.
  • MINVALUE : Specifies the minimum value of the serial with 38 digits or less. MINVALUE must be smaller than or equal to the initial value and smaller than the maximum value.
  • NOMINVALUE : 1 is set automatically as a minimum value for the ascending serial; -(10)36 for the descending serial.
  • MAXVALUE : Specifies the maximum number of the serial with 38 digits or less. MAXVALUE must be smaller than or equal to the initial value and greater than the minimum value.
  • NOMAXVALUE : (10)37 is set automatically as a maximum value for the ascending serial; -1 for the descending serial.
  • CYCLE : Specifies that the serial will be generated continuously after reaching the maximum or minimum value. If the ascending serial reaches the maximum value, the minimum value is generated as the next value. If the descending serial reaches the minimum value, the maximum value is generated as the next value.
  • NOCYCLE : Specifies that the serial will not be generated any more after reaching the maximum or minimum value. The default is NOCYCLE.

Caution To change the initial value of Serial, you cannot modify the db_serial table because that is a system catalog. Therefore, the file exported  (unloaded) from later than CUBRID 2008 R2.0 cannot be imported (loaddb) in 2008 R1.x.

Example

The following is an example of altering the increment of the order_no serial to 2.

ALTER SERIAL order_no INCREMENT BY 2;