Home » RDBMS Server » Server Administration » Renaming a column in a table
Renaming a column in a table [message #51379] Mon, 20 May 2002 02:38 Go to next message
siva
Messages: 58
Registered: August 1999
Member
Hello,
I want to rename a column in a table which contains data.I cant drop/recreate the table or export/import the data of that table .
SO is there any direct command to rename a column of a table.It has no constraints.

Regards
Siva
Re: Renaming a column in a table [message #51382 is a reply to message #51379] Mon, 20 May 2002 07:27 Go to previous messageGo to next message
Grant
Messages: 578
Registered: January 2002
Senior Member
I don't think so. You will need to use export/import or create the table as select:

SQL> create table NEWTABLE as select col1,col2,col4 from OLDTABLE;
SQL> drop table OLDTABLE;
SQL> rename NEWTABLE to OLDTABLE;
Re: Renaming a column in a table [message #51396 is a reply to message #51379] Tue, 21 May 2002 09:37 Go to previous message
Sanjay Bajracharya
Messages: 279
Registered: October 2001
Location: Florida
Senior Member
This is possible if you have Oracle8i or higher

1. Create the new column in the table
2. Update the table and put the original column value into the new column
3. Drop the old column in the table

Cheers.
Previous Topic: ORA-04031: unable to allocate 4096 bytes of shared memory
Next Topic: format of data in tables
Goto Forum:
  


Current Time: Fri Sep 13 00:30:39 CDT 2024