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

Home -> Community -> Usenet -> c.d.o.misc -> Re: alter question

Re: alter question

From: Jerry Gitomer <jgitomer_at_p3.net>
Date: Fri, 10 Apr 1998 22:13:33 -0400
Message-ID: <352ED1CD.3EAF@p3.net>


Hi Martin,

I hate to break the bad news -- but the only way I can think of to actually rename a column is to recreate the table. You can do this in a four step process:

  1. RENAME table TO temp_name;
  2. Edit the DDL you used to create the table and change the column name
  3. Run the DDL statement
  4. INSERT INTO table SELECT * FROM temp_name;

If you don't wish to recreate the table there are two alternatives that might be suitable. The first is to create a view of the table with only the one column name changed. The second is always use an alias when selecting the column, e.g.

        SELECT column1, column2, ugly_name good_name, columnx FROM table;

Regards

Jerry   

Martin Meadows wrote:
>
> Well, I thought I sent this question yesterday but I don't see it posted
> so here it is again ... hopefully it won't be posted twice.
>
> I need to change the name of a column in a table. What's the best way to
> do that? I assume it's with the alter command but I can't seem to figure
> out the correct syntax.
>
> Thanks,
> Martin Meadows

--
Jerry Gitomer Since I know how to spell DBA I became one. jgitomer_at_p3.net Received on Fri Apr 10 1998 - 21:13:33 CDT

Original text of this message

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