What are the various things that happen when I drop a column from a filled table. In all_tab_columns, does the column_id of other columns get reset?
No data gets modified. The column metadata gets marked as 'deleted' and will be ignored.
To drop a column in an existing table in Oracle, here is the syntax: ALTER TABLE table_name DROP COLUMN column_name; To drop multiple columns in an existing table: ALTER TABLE table_name DROP (column_name1, column_name2,…);
Dropping a table removes the table definition from the data dictionary. All rows of the table are no longer accessible. All indexes and triggers associated with a table are dropped. All views and PL/SQL program units dependent on a dropped table remain, yet become invalid (not usable).
Use the COMMENT statement to add a comment about a table, view, materialized view, or column into the data dictionary. To drop a comment from the database, set it to the empty string ' '.
alter table drop column
will actually visit each block and remove the column data - and that's an expensive thing to do for a large table.
You might find it more prudent to issue:
alter table set unused
which just flags the column as "gone" in the dictionary. If you then still need to reclaim that space, you can schedule an "alter table drop unused" at a quiet time
The actions will include at least the following:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With