Oracle Rename Column – alter table, rename column Example SQL Syntax

AshokTechnical Tips7 Comments

Following is simple example syntax for renaming a column to an Oracle table using “alter table” SQL:

1
2
ALTER TABLE [my_table_name]
RENAME COLUMN [current_column_name] TO [new_column_name];

A simple example would be:

1
2
ALTER TABLE employee
RENAME COLUMN f_name TO first_name;

Like renaming an Oracle table, you should be aware of any dependencies in code, etc. that reference a table column by name. Oracle does make the required changes within a database in many cases, but of course, you should ensure all is working and update any components that reside outside the database. You can use tools like TOAD to easily check dependencies on a table in a visual manner. Below is a screenshot within TOAD of the “Used By” tab that can be accessed when your table is selected in the schema browser:

used_by

7 Comments on “Oracle Rename Column – alter table, rename column Example SQL Syntax”

  1. ALTER TABLE [my_table_name]
    RENAME COLUMN [current_column_name] TO [new_column_name];

    Sir,I executed this command for altering the column name in my table but its giving the following error

    ERROR at line 1:
    ORA-14155: missing PARTITION or SUBPARTITION keyword

  2. i executed this query but it only works when there is no data in that column when data is inserted n this query is applied it gives error.so pls help mi to write query which can rename the column name or table name which contains data

    1. I don’t think having data in the column is your issue since you can indeed rename a column even when data exists.

      Though this is not a support forum, feel free to share details of your environment and error message(s) in case someone has an idea for you.

  3. @archana,

    did you executed it as “SYS” user? syntax would be
    alter owner.table table_name rename column current_col_name TO new_col_name;
    hth.

Leave a Reply

Your email address will not be published. Required fields are marked *