Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to rename a column name?
Hi,
I know one way, This might solve ur problem
like
suppose u have table 'x' in which u want to rename
a column
first u create 'y' with same structure as above
but with the column renamed as u want.
INSERT INTO Y(col1,col2,renamedcol) SELECT (col1
col2,col3) FROM x;
use this to transfer the data from table x to table y
(Assuming u haved renamed col3 to renamecol)
now rename table x to tabled z
and then rename table y to table x
using command
Rename oldtablename TO newtablename;
Now at this stage u might have achieved what u want.
After that u can disable the constraints from
table x using command
alter table disable constraints CONSTRAINT_NAME;
OR drop the constraint using command
alter table drop constraints CONSTRAINT_NAME;
Finally drop the table X.
I think this will solve ur query.
Thanks,
sudhakar
In article <7rimke$e4a$1_at_nnrp1.deja.com>,
wy3141_at_my-deja.com wrote:
> I want to change the column name,and I don't want to drop it and
> recreate it. Because it has some dependencies(role right,constraints)
> on it.
> Can Oracle support change the column name directly?
> Any suggestion are helpful.
> Thanks in advance.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Tue Sep 14 1999 - 09:37:01 CDT
![]() |
![]() |