Solved

DROP COLUMN IN ORACLE7

Posted on 2004-09-14
7
869 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 35

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

861 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

23 Experts available now in Live!

Get 1:1 Help Now