Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to rename a column name?

Re: How to rename a column name?

From: John Chiu <johnymc_at_netscape.com>
Date: Wed, 15 Sep 1999 06:36:06 -0400
Message-ID: <37DF7696.D7E83E73@netscape.com>


you have to rebuild all of your constraints & grant access right to the roles to this new table. This will be cumbersome.

John Chiu
johnymc_at_netscape.net

sudhakar_mph_at_my-deja.com wrote:

> 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
Received on Wed Sep 15 1999 - 05:36:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US