Home » SQL & PL/SQL » SQL & PL/SQL » rename multiple columns
rename multiple columns [message #366183] Fri, 12 December 2008 00:31 Go to next message
panyam
Messages: 146
Registered: May 2008
Senior Member
Hi ,

How to renmae multiple columns of a table in a single alter statement.
SQL> desc del;
 Name                                      Null?    Type
 ----------------------------------------- -------- -------------
 VAR1                                               NUMBER
 VAR2                                               NUMBER


for a single column the following works.

SQL> ed
Wrote file afiedt.buf

  1* alter table del rename column var1 to i
SQL> /

Table altered
.

Re: rename multiple columns [message #366185 is a reply to message #366183] Fri, 12 December 2008 00:44 Go to previous messageGo to next message
Kevin Meade
Messages: 2103
Registered: December 1999
Location: Connecticut USA
Senior Member
last I knew, this was not possible. You had to execute two alter table commands, one for each column to be renamed.

Until Oracle decides to change it, we are stuck with it.

Have you tried executing an alter with two rename statements in it?

alter table del
   rename column var1 to i
   rename column var2 to j
/

See if it works. Not too hard to figure this out for yourself I think.

Good luck, Kevin
Re: rename multiple columns [message #366186 is a reply to message #366183] Fri, 12 December 2008 00:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68757
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
SQL> alter table t rename column c1 to v1 rename column c2 to v2;
alter table t rename column c1 to v1 rename column c2 to v2
*
ERROR at line 1:
ORA-23290: This operation may not be combined with any other operation

Is this clear?

Regards
Michel
Re: rename multiple columns [message #366214 is a reply to message #366186] Fri, 12 December 2008 02:51 Go to previous messageGo to next message
panyam
Messages: 146
Registered: May 2008
Senior Member

Hi All,

I tried as u said before posting ....but just want to know any other way to do it.

How ever thaks for the reply.
Re: rename multiple columns [message #366217 is a reply to message #366214] Fri, 12 December 2008 02:56 Go to previous message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
renaming multiple column at a stretch may be the need. But oracle supports one by one renaming. To my knowledge, upto 10G this facility is not available. Let me also wait for some updating.
yours
dr.s.raghunathan
Previous Topic: delete cascade
Next Topic: Statspack Error
Goto Forum:
  


Current Time: Thu May 22 05:32:11 CDT 2025