Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to change column names?
There is a faster method, but be careful with it. I think it is very interesting when you "must" rename a column of a large table.
UPDATE col$ SET name = '&new_name'
WHERE (name = '&old_name') and
(obj# = (SELECT obj# FROM obj$ WHERE (name = '&table_name') and (owner# = (SELECT user# FROM user$ WHERE name ='&user'))));
It is very important to drop any indexes, foreing keys and primary constraints that might be on the column. These can be re-created later.
Cheers
aaronurbain_at_bigfoot.com escribió en artÃculo
<6ueof2$ge4$1_at_nnrp1.dejanews.com>...
> In article <6u6t6v$a2b$1_at_nnrp1.dejanews.com>,
> badstreetboy_at_my-dejanews.com wrote:
> > I know 'alter table' can add column or change datatype of a column.
But can
> > it change column name?
> >
> > Thanks..
> >
> > -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> > http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
> >
>
> no. rename the table, create the table with the new name, and
insert(select).
> dont forget your constraints, grants and triggers.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
Received on Fri Sep 25 1998 - 00:00:00 CDT
![]() |
![]() |