Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop a column from a table

Status
Not open for further replies.

oracle80

Programmer
Nov 23, 2000
1
SE
Hi

I have problem to drop(delete) a column from a table.

I wrote:
SQL> alter table myLang drop column abc;

While "myLang is the table name and "abc" is the column name. I got an error message:
alter table myLang drop column abc
*
Error with row 1:
ORA-00905: missing keyword

How should I write the correct command?
I run oracle8 on a Linux(Unix type) platform.
Regards

Zhao Yue
 
Hi,

try this (credit to carp)

-- create a tmp table with just the columns you want to keep
create table tmp_t as select col_1, col_3 from test_t;
-- lose the original table (check the tmp table first though)
drop table test_t;
-- rename the tmp tableto the original tables name
RENAME tmp_t TO test_t;

Mike
michael.j.lacey@ntlworld.com
 
You didn't mention which "Oracle8" you are using. Unless you are using 8.1.*, you can't drop columns with the ALTER TABLE comman.
 
carp is right.
if u r using older version than 8.1.x
then try mike's way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top