This topic describes the conversion scope of constraint modification, dropping, and addition in ALTER TABLE DDL operations during data migration from an Oracle database to an Oracle tenant of OceanBase Database.
Syntax
constraint_clauses:
{ ADD { { out_of_line_constraint }...
| out_of_line_REF_constraint
}
| MODIFY { CONSTRAINT constraint_name
| PRIMARY KEY
| UNIQUE (column [, column ]...)
} constraint_state [ CASCADE ]
| RENAME CONSTRAINT old_name TO new_name
| { drop_constraint_clause }...
}
out_of_line_constraint:
[ CONSTRAINT constraint_name ]
{ UNIQUE (column [, column ]...)
| PRIMARY KEY (column [, column ]...)
| FOREIGN KEY (column [, column ]...) references_clause
| CHECK (condition)
} [ constraint_state ]
out_of_line_REF_constraint:
{ SCOPE FOR ({ ref_col | ref_attr })
IS [ schema. ] scope_table
| REF ({ ref_col | ref_attr }) WITH ROWID
| [ CONSTRAINT constraint_name ] FOREIGN KEY
( { ref_col [, ref_col ] | ref_attr [, ref_attr ] } ) references_clause
[ constraint_state ]
}
drop_constraint_clause:
(
DROP ( ( PRIMARY KEY
| UNIQUE "(" (column)... ")"
| CONSTRAINT constraint_name )
[ CASCADE ] [( KEEP | DROP ) INDEX ]
)
[ ONLINE ]
)
Supported operations
Dropping a constraint by specifying CONSTRAINT constraint_name
in the drop_constraint_clause
clause is supported. Only one constraint can be dropped at a time. Sample code:
ALTER TABLE T DROP CONSTRAINT CST;
Unsupported operations
Dropping the primary key or unique key is not supported. An error will be returned when you perform this operation.
Adding new constraints is not supported. An error will be returned when you perform this operation.
Modifying constraints is not supported. An error will be returned when you perform this operation.
Renaming constraints is not supported. An error will be returned when you perform this operation.
Ignored clauses and options
The following clauses and options will be ignored and will not be resolved or converted when they are specified in the synchronized DDL statements.
The CASCADE clause.
The KEEP | DROP INDEX clause for specifying whether to keep or drop indexes.
The ONLINE option for allowing table DML operations when dropping a constraint.