Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Renaming a Column
Below are the steps and examples to rename a table:
vantive> desc salgrade;
Name Null?
Type
View created.
2. create a new table with new column names, and select * from the view you just created.
vantive> create table salgrade_new (grade_new, losal_new, hisal_new) 2 as select * from salgrade_vw;
Table created.
Elapsed: 00:00:00.26
vantive> desc salgrade_new;
Name Null?
Type
NUMBER LOSAL_NEW NUMBER HISAL_NEW NUMBER
3. drop the table which you want to change its column name.
vantive> drop table salgrade;
Table dropped.
4. Rename the table which you created on step 3 to the table name which you
dropped on step 3.
vantive> alter table salgrade_new rename to salgrade;
Table altered.
Elapsed: 00:00:00.02
vantive> desc salgrade;
Name Null?
Type
NUMBER LOSAL_NEW NUMBER HISAL_NEW NUMBER
By the way, you can also drop the view you created on step 2 now.
Good luck,
Eveleen
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: exu_at_nnng.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing ListsReceived on Wed Feb 14 2001 - 10:10:18 CST
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).