Solved

DROP COLUMN IN ORACLE7

Posted on 2004-09-14
7
868 Views
Last Modified: 2008-02-01
HI ALL..
HOW COLUMN CAN BE DROPPED IN ORACLE7
MUCH THANKS
0
Comment
Question by:mohd_osman
7 Comments
 
LVL 33

Accepted Solution

by:
sajuks earned 50 total points
ID: 12052808
create a table newtable as select col1,col2,col3 from existingtablename(exclude the columns you dont want)
  drop the existingtablename
  rename the newtable as the existingtablename
// dont forget the table/data backup before trying this.

0
 

Author Comment

by:mohd_osman
ID: 12052860
i already know this way but i am asking
for direct DDL command
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12052865
Unless you have oracle 8i and above its not possible.
From your question i assume you have oracle 7 ?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 33

Expert Comment

by:sajuks
ID: 12052874
oracle 8i and above,
ALTER TABLE EMP DROP COLUMN ENAME;

Drop the column from a table
--------------------------
alter table TABLE_NAME drop column COLUMN_NAME
 /
0
 
LVL 7

Expert Comment

by:BobMc
ID: 12056256
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.
0
 
LVL 34

Expert Comment

by:Mark Geerlings
ID: 12056259
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.
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12100954
Thanks for the points and grade
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now