Link to home
Start Free TrialLog in
Avatar of mohd_osman
mohd_osman

asked on

DROP COLUMN IN ORACLE7

HI ALL..
HOW COLUMN CAN BE DROPPED IN ORACLE7
MUCH THANKS
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mohd_osman
mohd_osman

ASKER

i already know this way but i am asking
for direct DDL command
Unless you have oracle 8i and above its not possible.
From your question i assume you have oracle 7 ?
oracle 8i and above,
ALTER TABLE EMP DROP COLUMN ENAME;

Drop the column from a table
--------------------------
alter table TABLE_NAME drop column COLUMN_NAME
 /
Cant do it directly in oracle7  - create a view minus the columns you dont want, and reference that instead. Its normally not worth the hassle/risk of removing the column.
Sajuks is correct, "drop column" is not supported in Oracle7.  One work-around that may help you is to rename the table, then create view that has only the columns you want.  If you do this, make sure that you check the grants on the table and give the same grants on the view.  Also, make sure that the column you do not want is not "NOT NULL".  If it is, you will have to change that if you want to support inserts through the view.
Thanks for the points and grade