All Products
Search
Document Center

ApsaraDB for OceanBase:Change the length of a constrained column

Last Updated:Jun 03, 2024

This topic describes the incompatibilities between an Oracle database and an Oracle tenant of OceanBase Database in changing the lengths of columns that have different constraints.

Change the length of a PRIMARY KEY column

The following table describes the incompatibilities between an Oracle database and an Oracle tenant of OceanBase Database in changing the length of a PRIMARY KEY column by using the ALTER TABLE table_name MODIFY DDL statement.

Column type in Oracle database

Allowed operation

Column type in Oracle tenant of OceanBase Database

Allowed operation

INTEGER

-

NUMBER(38,0)

-

INT

-

NUMBER(38,0)

-

SMALLINT

-

NUMBER(38,0)

-

BINARY_FLOAT

-

BINARY_FLOAT

-

BINARY_DOUBLE

-

BINARY_DOUBLE

-

DECIMAL

Increase and decrease the length

NUMBER

Increase the length

DEC

Increase and decrease the length

NUMBER

Increase the length

NUMERIC

Increase and decrease the length

NUMBER

Increase the length

REAL

Increase and decrease the length

NUMBER

Increase the length

FLOAT

Increase and decrease the length

FLOAT

Increase the length

NUMBER

Increase and decrease the length

NUMBER

Increase the length

NCHAR

Increase and decrease the length

NCHAR

Increase the length

CHAR

Increase and decrease the length

CHAR

Increase the length

CHARACTER

Increase and decrease the length

CHAR

Increase the length

NVARCHAR2

Increase and decrease the length

NVARCHAR2

Increase the length

VARCHAR2

Increase and decrease the length

VARCHAR2

Increase the length

VARCHAR

Increase and decrease the length

VARCHAR2

Increase the length

RAW

Increase and decrease the length

RAW

Increase the length

ROWID

-

ROWID

-

UROWID

-

UROWID

-

TIMESTAMP

Increase and decrease the length

TIMESTAMP

Increase the length

TIMESTAMP WITH LOCAL TIME ZONE

Increase and decrease the length

TIMESTAMP WITH LOCAL TIME ZONE

Increase and decrease the length

DATE

-

DATE

-

INTERVAL YEAR TO MONTH

Increase and decrease the length

INTERVAL YEAR TO MONTH

Increase and decrease the length

INTERVAL DAY TO SECOND

Increase and decrease the length

INTERVAL DAY TO SECOND

Increase and decrease the length

Change the length of a UNIQUE KEY column

The incompatibilities between the Oracle database and the Oracle tenant of OceanBase Database in changing the length of a UNIQUE KEY column by using the ALTER TABLE table_name MODIFY DDL statement are the same as that in changing the length of a PRIMARY KEY column.

Change the length of a column with a CHECK constraint

The following table describes the incompatibilities between an Oracle database and an Oracle tenant of OceanBase Database in changing the length of a column that has a CHECK constraint by using the ALTER TABLE table_name MODIFY DDL statement.

Column type in Oracle database

Allowed operation

Column type in Oracle tenant of OceanBase Database

Allowed operation

INTEGER

-

NUMBER(38,0)

-

INT

-

NUMBER(38,0)

-

SMALLINT

-

NUMBER(38,0)

-

BINARY_FLOAT

-

BINARY_FLOAT

-

BINARY_DOUBLE

-

BINARY_DOUBLE

-

DECIMAL

Increase and decrease the length

NUMBER

-

DEC

Increase and decrease the length

NUMBER

-

NUMERIC

Increase and decrease the length

NUMBER

-

REAL

Increase and decrease the length

NUMBER

-

FLOAT

Increase and decrease the length

FLOAT

-

NUMBER

Increase and decrease the length

NUMBER

-

NCHAR

Increase and decrease the length

NCHAR

-

CHAR

Increase and decrease the length

CHAR

-

CHARACTER

Increase and decrease the length

CHAR

-

NVARCHAR2

Increase and decrease the length

NVARCHAR2

-

VARCHAR2

Increase and decrease the length

VARCHAR2

-

VARCHAR

Increase and decrease the length

VARCHAR2

-

RAW

Increase and decrease the length

RAW

-

ROWID

-

ROWID

-

UROWID

-

UROWID

-

TIMESTAMP

Increase and decrease the length

TIMESTAMP

-

TIMESTAMP WITH LOCAL TIME ZONE

Increase and decrease the length

TIMESTAMP WITH LOCAL TIME ZONE

-

DATE

-

DATE

-

INTERVAL YEAR TO MONTH

Increase and decrease the length

INTERVAL YEAR TO MONTH

-

INTERVAL DAY TO SECOND

Increase and decrease the length

INTERVAL DAY TO SECOND

-

Change the length of a FOREIGN KEY column

The incompatibilities between the Oracle database and the Oracle tenant of OceanBase Database in changing the length of a FOREIGN KEY column by using the ALTER TABLE table_name MODIFY DDL statement are the same as that in changing the length of a PRIMARY KEY column.