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

Home -> Community -> Usenet -> c.d.o.tools -> Re: rename a column

Re: rename a column

From: ledz <ian_ledzion_at_urbanet.ch>
Date: Sun, 11 Feb 2001 20:47:42 +0100
Message-ID: <966q4i$mgf$1@news1.urbanet.ch>

If you're using 8i, you can drop columns. What you do is create a column with the new name, copy the data into it, and drop the old column.

<robertboyle_at_my-deja.com> wrote in message news:95uj17$vkm$1_at_nnrp1.deja.com...
> In article <95ui8l$uue$1_at_nnrp1.deja.com>,
> rannerde_at_my-deja.com wrote:
> > Dear NG!
> > How do I rename an existing column of a table with Oracle SQL?
> >
> > Thank you,
> > Gerfried Ranner
> >
> > Sent via Deja.com
> > http://www.deja.com/
> >
> You can't rename a column. Try creating a temp table with your data
> and then dropping and recreating your table:
>
> CREATE TABLE temptable AS
> SELECT * FROM existingtable;
>
> DROP TABLE exisitingtable;
>
> CREATE TABLE (new definitions and column names);
>
> INSERT INTO existingtable
> SELECT * FROM temptable;
>
> DROP TABLE temptable;
>
> COMMIT;
>
>
> Sent via Deja.com
> http://www.deja.com/
Received on Sun Feb 11 2001 - 13:47:42 CST

Original text of this message

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