Search the Site

Sponsors

bottom corner

Drop columns in an Oracle table

The "alter table" command in Oracle can be used to drop columns that you no longer need to use.

This page is filed under keyword(s): oracle.

The following example demonstrates how it could be done.

alter table schema1.my_table drop column unused_field;

There is also an alternative syntax that could be used to drop multiple fields at once.

alter table schema1.my_table drop (unused_field); -- Dropping one field only
alter table schema1.my_table drop (unused_field1, unused_field2); -- Dropping two fields

In the second example, if you need to drop more than two fields, just keep adding them within the parenthesis, separated by commas.

Did you find this page useful? Please consider browsing other articles or subscribing to the RSS feed to keep up with latest.

This page is filed under keyword(s): oracle.
Author: C. Peter Chen
Last updated: 18 Jun 2008

bottom corner