Can we Change a Column Name

Suppose I have a table names student having a column named as "> roll_no". now I have to change its name by " registration_no ". Can we do this?

---

Renaming a column in Oracle is not possible.
If required at anycost, you have to create another table with the help of existing table by excluding the column to be renamed and later you have to add that column in the required name.
 

Renaming a column of an Oracle is possible.
ALTER TABLE  <table_name > RENAME COLUMN <old_column_name> to <new_column_name>

Column rename feature is supported by oracle 9.x onwards

Thus in caes you are using oracle 9.x or later versions use following query
ALTER TABLE tablename RENAME COLUMN oldcolumn TO newcolumn;
In case you are usinf oracle prior to 9 use following options.
 

Other workarounds:
1. -- Use a view with correct column names...
   rename t1 to t1_base;
   create view t1 <column list with new name> as select * from t1_base;

2. -- Recreate the table with correct column names...
   create table t2 <column list with new name> as select * from t1;
   drop table t1;
   rename t2 to t1;

3. -- Add a column with a new name and drop an old column...
   alter table t1 add ( newcolame datatype );
   update t1 set newcolname=oldcolname;
   alter table t1 drop column oldcolname;
~ Pratibha
 

You can rename a column in oracle.
try this,
ALTER TABLE tablename RENAME COLUMN oldcolumn TO newcolumn;

~ Ranjith M.G

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.