Re: Dropping fields from table description ?
Date: Fri, 25 Feb 1994 07:51:54 GMT
Message-ID: <mannhart-250294084404_at_zuvmaclm.unizh.ch>
In article <2kj3tq$iqm_at_reznor.larc.nasa.gov>, jka_at_air77.larc.nasa.gov (J. Keith Alston) wrote:
> Hi,
> Does anyone know if there is a way to drop a field from a table description in
> Oracle 6 on a VAX? All of the references that I have show you how to modify a
> field or add a field but not how to drop a field. Any help would be greatly appreciated.
It is not possible to drop or shrink a column (other than some hacks in the data dictionary as user sys so you can easily destroy your hole database, and chances are good you will). Workaroud is: create a new table with the columns you want from the old table, then drop the old table and rename the new table to the name of the old one.
SQL> create table new_table as ( 1> select column1, column3, substr(column4,1 15) column4 2> from old_table );
table created.
SQL> drop table old_table;
table dropped.
SQL> rename new_table to old_table ;
Remeber, with the "drop table" command you will loose all the indexes, grants etc. on the table so check it before
> Thank you.
You're welcome
>
> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
> Keith Alston Lockheed Eng & Sci Co + There's a less than 5% chance of
> MS 130 Nasa LaRC Hampton VA 23666 = tonight and tomorrow
> jka_at_air77.larc.nasa.gov +
-- Leo Mannhart Planning Office University of Zurich phone: ++41 1 257 23 34 Kuenstlergasse 15 fax: ++41 1 257 22 12 CH-8001 Zurich, Switzerland eMail: mannhart_at_zuv.unizh.chReceived on Fri Feb 25 1994 - 08:51:54 CET