[Webinar] Learn how to a build a cloud-first strategyRegister Now


How to Delete an Oracle table using Java?

Posted on 2004-11-08
Medium Priority
Last Modified: 2010-04-17
Thank you in advance.
How do I delete a table inOracle 9i using Java code?
Do I have to append data and use a result set? Or do I have to use prepared statments. If so what statements are necessary to perform a java/Oracle Delete of a table?    
Question by:coolgem
  • 2
  • 2
LVL 48

Accepted Solution

Mikal613 earned 1000 total points
ID: 12526221
try {
        // Create a statement
        Statement stmt = connection.createStatement();
        // Drop table object1_table and types object1 and object2
        stmt.execute("DROP TABLE object1_table");
        } catch (SQLException e) {
        // A drop statement will throw an exception if the table or type does not exist

Author Comment

ID: 12526888
Is that different from deleting a record from a table?
LVL 48

Assisted Solution

Mikal613 earned 1000 total points
ID: 12526917
well deleteing a record would just be a different statement

delete * from table where whateverer = 2
LVL 22

Expert Comment

by:Helena Marková
ID: 12530760
As an addition to Mikal613 - you have to have a permissions for droping table if you want to do it.

Author Comment

ID: 12533137
Thnak you Mikal613 & Henka

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

865 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