Sayantan's Blog On Oracle

Sayantan's blogs on Oracle

Learn Oracle with Sayantan

DROP Table Statement in Oracle

DROP Table Statement in Oracle

DROP statement is used to do below operations:

  • DROP ONE OR MORE EXISTING COLUMNS
  • DROP AN EXISTING TABLE

DROP ONE OR MORE EXISTING COLUMNS:

We have an existing table called EMP_ALTER_TAB with below definition:

DROP Table Statement in Oracle : output
DROP Table Statement in Oracle : output

DROP SINGLE COLUMN:

ALTER TABLE EMP_ALTER_TAB DROP(JOB_ID);
DESC EMP_ALTER_TAB;
ALTER TABLE EMP_ALTER_TAB DROP COLUMN LAST_NAME;
DESC EMP_ALTER_TAB;

DROP MULTIPLE COLUMNS:

ALTER TABLE EMP_ALTER_TAB DROP(HIREDATE,
                               SALARY,
                               DEPARTMENT_ID);
DESC EMP_ALTER_TAB;

DROP AN EXISTING TABLE:

DROP TABLE EMP_ALTER_TAB;
SELECT TABLE_NAME, 
       TABLESPACE_NAME, 
       STATUS, 
       NUM_ROWS, 
       TABLE_LOCK
FROM USER_TABLES
WHERE TABLE_NAME = 'EMP_ALTER_TAB';

RELATED TOPICS:

Leave a Comment

Your email address will not be published.