Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Rename a column
On Mon, 20 Apr 1998 21:00:35 +0800, "Lui Yuan Tze"
<ssplyt_at_pacific.net.sg> wrote:
>How does one rename a table column ?
You can't. You either have to recreate the table, or fudge a bit. If you don't want to recreate the table, or don't have the time, you can do the following:
UPDATE table set new_column = old_column;
3. Make sure that you make the old column nullable. 4. Tell everyone to use the new column name. The old column will just linger on but won't be used. 5. You might also consider a trigger that aborts on any attempt to insert a value into the old column. I usually don't do this. If I'm concerned about this, then I recreate the table.
Sometimes I'll do steps 1-4 above as a quick measure to satisify the programmers, users, etc, and later I'll come back and rebuild the table without the old column.
regards,
Jonathan Received on Tue Apr 21 1998 - 22:01:35 CDT