How to modify the column name in oracle

Jul 24, 2012, by admin

This article gives steps to change name of a in a table in oracle or PL/SQL.

 oracleSteps to modify the column name in oracle

 Login to sqlplus through an user which has permissions to change the given table structure. Example: “sqlplus user1/user1”.

 Optional step: desc “table-name”. This is an optional step to check the column names current present in given table. This is to make sure that the column name being changed is indeed present in the table.

oracle-logo-1

 Run command: alter table “table-name” rename column “column-old-name” to “column-new-name”. As the name suggests, alter table command is used to make any changes to table structure. Changing column name is also considered as an operation which alters table structure. ‘rename column’ is the sub-command to alter table. It is required to pass old column name and new column name.

modify-the-column-name-in-oracle

 If the new column name is not already present in the table, oracle or PL/SQL shall alter the table structure by changing column name. Upon successful execution, the output shall look like this: Table altered.

oracle-logo

 Optional step: desc “table-name”. Run this command again to confirm the change in column name.