Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Drop column from a table
JMH <JMH_at_badlands.com> wrote in message
news:85oa2u$e81$1_at_bob.news.rcn.net...
> I'm using Oracle 7.3.4 and have decided to move two columns from one
> table to another table. I would have thought I could just do an ALTER
> command but that doesn't seem to work and I cannot find any example
> for check my syntax. Here's the statement:
>
> alter table T drop column C
>
> I also tried without teh "column" bit but got the same results.
>
> Can I drop a column from table?
>
No, you need to drop the whole table and recreate it again without the
columns you no longer want.
If you need to preserve the data, you will have to store it away somewhere
temporarily. The usual
way to do this is just create another table and copy the data there while
you mess with the original
one. Numerous people have written scripts to do this sort of thing, I'm sure
you can find something
to download from the web, if you can't be bothered doing it yourself.
Another approach is simply to leave the existing columns there. They won't
do much harm, apart
from taking up a little space. You can minimise this by setting all the
values to NULL.
The other option is to upgrade to Oracle 8, which I believe supports alter
table drop column.
Phil. Received on Tue Jan 18 2000 - 05:27:49 CST