Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: really dumb oracle newbie question:
Ralf Sandner wrote:
>
> hi...
>
> i feel like a complete dork: i just can't figure out the correct
> syntax to delete a column from an existing table...
>
> i tried
>
> ALTER TABLE -tablename-
> DROP (-columnname-);
>
> and after getting a "missing" keyword error
>
> ALTER TABLE -tablename-
> DROP COLUMN (-columnname-);
>
> but both did not work...
>
> there is no key or index on the column and there is no data stored
>
> --
> Ralf Sandner email: r.sandner_at_system-design.com
> System-Design GmbH rsandner_at_haitec.de
> Planstr. 25 www: http://www.system-design.com
> D-71229 Leonberg-Warmbronn Tel.: +49 07152 9764 786
I'm afraid you can't drop a column from a table.
The best you can do is:
1) Ignore it (just don't reference it: it isn't doing any harm!)
2) Create a view which omits reference to it (such a view is updatable,
insertable, etc)
3) Create a new table from the old one by selecting just those columns
you want, with appropriate re-naming, and then dropping the old table.
HTH
-- Chrysalis FABRICATI DIEM, PVNC ('To Protect and to Serve') Terry Pratchett : "Guards Guards"Received on Mon Sep 29 1997 - 00:00:00 CDT