How to Delete an Oracle table using Java?

Posted on 2004-11-08
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
    LVL 48

    Accepted Solution

    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

    Is that different from deleting a record from a table?
    LVL 48

    Assisted Solution

    well deleteing a record would just be a different statement

    delete * from table where whateverer = 2
    LVL 22

    Expert Comment

    As an addition to Mikal613 - you have to have a permissions for droping table if you want to do it.

    Author Comment

    Thnak you Mikal613 & Henka

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    A short article about a problem I had getting the GPS LocationListener working.
    A short article about problems I had with the new location API and permissions in Marshmallow
    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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now