Solved

DROP COLUMN IN ORACLE7

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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Developer 6 60
Distinct values from all columns in a table?? PL SQL 4 48
PL SQL Developer 7 52
Where Does Time Value Come From for Database Insert or Update 4 33
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
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 videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
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.

809 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