We help IT Professionals succeed at work.

renaming a column

sesh2002
sesh2002 asked
on
Medium Priority
1,536 Views
Last Modified: 2012-05-05
From google, from redhat database details we got the following:
ALTER TABLE TABLENAME RENAME [COLUMN] columnname1 to columnname2; But this is what happened:
Alter table SW_CS_CSRADDON RENAME KIDS0TO3 to KIDS0TO4
                                  *
ERROR at line 1:
ORA-14155: missing PARTITION or SUBPARTITION keyword
What can be the exact command. Can we do it in a indirect way using dumps or queries. ---sesh2002
Comment
Watch Question

Commented:
Hi,

ALTER TABLE ... RENAME ... is the command for renaming partition or subpartition of a table. So far I don't know a direct command for that. Just a small trick.

add new column

ALTER TABLE SW_CS_CSRADDON ADD KIDS0TO4 <data types and other clause....>; --change the <...> as you want

"move" data from KIDS0TO3 to KIDS0TO4

UPDATE SW_CS_CSRADDON SET KIDS0TO4 = KIDS0TO3;

then drop column KIDS0TO3

ALTER TABLE SW_CS_CSRADDON DROP (KIDS0TO3);

best regards,
MArius Nicoras

Explore More ContentExplore courses, solutions, and other research materials related to this topic.