Oracle 5.0 Reference Manual page 1467

Table of Contents

Advertisement

Replication and Binary Logging Options and Variables
Option Sets Variable
Variable Name
Variable Scope
Dynamic Variable
auto_increment_increment
use with master-to-master replication, and can be used to control the operation of
columns. Both variables have global and session values, and each can assume an integer value
between 1 and 65,535 inclusive. Setting the value of either of these two variables to 0 causes its
value to be set to 1 instead. Attempting to set the value of either of these two variables to an integer
greater than 65,535 or less than 0 causes its value to be set to 65,535 instead. Attempting to set
the value of
auto_increment_increment
noninteger value gives rise to an error, and the actual value of the variable remains unchanged.
These two variables affect
auto_increment_increment
For example:
mysql>
SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name
+--------------------------+-------+
| auto_increment_increment | 1
| auto_increment_offset
+--------------------------+-------+
2 rows in set (0.00 sec)
mysql>
CREATE TABLE autoinc1
->
(col INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
Query OK, 0 rows affected (0.04 sec)
mysql>
SET @@auto_increment_increment=10;
Query OK, 0 rows affected (0.00 sec)
mysql>
SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name
+--------------------------+-------+
| auto_increment_increment | 10
| auto_increment_offset
+--------------------------+-------+
2 rows in set (0.01 sec)
mysql>
INSERT INTO autoinc1 VALUES (NULL), (NULL), (NULL), (NULL);
Query OK, 4 rows affected (0.00 sec)
Records: 4
Duplicates: 0
mysql>
SELECT col FROM autoinc1;
+-----+
| col |
+-----+
|
1 |
|
11 |
|
21 |
|
31 |
+-----+
4 rows in set (0.00 sec)
Yes,
auto_increment_increment
auto_increment_increment
Global, Session
Yes
Permitted Values
Type
numeric
Default
1
Range
1 .. 65535
[1446]
and
auto_increment_offset
[1446]
column behavior as follows:
AUTO_INCREMENT
[1446]
controls the interval between successive column values.
| Value |
|
| 1
|
| Value |
|
| 1
|
Warnings: 0
1447
[1446]
[1449]
or
auto_increment_offset
are intended for
AUTO_INCREMENT
[1449]
to a

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents