0
votes

when i was trying to delete all records form Oracle database using the following code i got this exception,

QUERYY:: delete from DMUSER.CAMERA_DATA1 java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

Actually here I wanted to create a data mining application using oracle SQL developer and the netbeans IDE. So my workflow is looks like as follow in oracle SQL developer,

enter image description here

The code part that I have used to delete a record from database as follows,

public void deleteData()throws SQLException {

    Statement stmt = null;
    String query = "delete from DMUSER.CAMERA_DATA1";

    System.out.println("QUERYY::  " + query);
    try {
        stmt = getConnection().createStatement();
        int rs = stmt.executeUpdate(query);
        if (rs > 0) {
            System.out.println("<-------------------Record Deleted--------------->");
        }
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        if (stmt != null) {
            stmt.close();
        }
    }

    }

I'm very new to the environment and searched many related questions even in stack but couldn't find exact answer which makes my work successful. Please help me to solve this.

1
You need to acknowledge the response and let everyone know, if problem was solved.Ravi

1 Answers

0
votes

QUERYY:: delete from DMUSER.CAMERA_DATA1 java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

You need to check, if CAMERA_DATA1 table/view exists in DMUSER schema or not.

Try connecting to same database and schema and check, if table exist or not. If not, then you need to create this table/view in same schema.

Referring to your screenshot provided, I can see CAMERA_DATA table instead of CAMERA_DATA1. So, you can either correct the SQL query to below

 String query = "delete from DMUSER.CAMERA_DATA";