Below are the steps and examples to rename a table:
1. create a view of the table which you want to rename its column
vantive> desc salgrade;
Name Null?
Type
----------------------------------------------------------------------- --------
------------------------------------
------------
GRADE
NUMBER
LOSAL
NUMBER
HISAL
NUMBER
vantive> create view salgrade_vw as select * from salgrade;
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
----------------------------------------------------------------------- --------
------------------------------------
------------
GRADE_NEW
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
----------------------------------------------------------------------- --------
------------------------------------
------------
GRADE_NEW
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: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).