RENAME COLUMN statement
Use the RENAME COLUMN statement to rename a column in a table.
The RENAME COLUMN statement allows you to rename an existing
column in an existing table in any schema
(except the schema SYS).
To rename a column, you must either
be the database owner or the table owner.
Other types of table alterations are possible;
see ALTER TABLE statement
for more information.
To rename the manager
column in table employee
, use the following syntax:
RENAME COLUMN EMPLOYEE.MANAGER TO SUPERVISOR
You can combine ALTER TABLE and RENAME COLUMN to modify a column's data
type. To change column c1
of table t
new data type NEWTYPE
ALTER TABLE t ADD COLUMN c1_newtype NEWTYPE
UPDATE t SET c1_newtype = c1
ALTER TABLE t DROP COLUMN c1
RENAME COLUMN t.c1_newtype TO c1
Restriction: If a view, trigger, check constraint, foreign key
constraint, or generation-clause of a generated column references the
column, an attempt to rename it will generate an error.
Restriction: The RENAME COLUMN statement
is not allowed if there are any open cursors that reference the column that
is being altered.
Note: If there is an index
defined on the column, the column can still be renamed; the index is
automatically updated to refer to the column by its new name