Deleting entire data from a particular column in oracle-sql

67,232

Solution 1

DELETE

The DELETE statement removes entire rows of data from a specified table or view

If you want to "remove" data from particular column update it:

UPDATE table_name
SET your_column_name = NULL;

or if column is NOT NULL

UPDATE table_name
SET your_column_name = <value_indicating_removed_data>;

You can also remove entire column using DDL:

ALTER TABLE table_name DROP COLUMN column_name;

Solution 2

Use Invisible Type, which is from an oracle 12cR2.

ALTER TABLE LOG1
MODIFY operation  INVISIBLE

It is a better than drop of a particular column.If you need to visible you can get back by altering with an VISIBLE of a column name.

Solution 3

In SQL, delete deletes rows not columns.

You have three options in Oracle:

  • Set all the values to NULL using update.
  • Remove the column from the table.
  • Set the column to unused.

The last two use alter table:

alter table t drop column col;
alter table t set unused (col);
Share:
67,232
Rajeev
Author by

Rajeev

Updated on July 31, 2022

Comments

  • Rajeev
    Rajeev over 1 year

    Recently I have started learning Oracle-sql. I know that with the help of DELETE command we can delete a particular row(s). So, Is it possible to delete entire data from a particular column in a table using only DELETE command. (I know that using UPDATE command by setting null values to entire column we can achieve the functionality of DELETE).