I am executing two prepared statement for deleting two records of different id. i want to delete both records in a single prepared statement execution my code is like this
String sqlDelete,sqlSelect2; sqlDelete = "delete from vul_detail where scanno=? and id=?";// PreparedStatement ps2=conn.prepareStatement(sqlDelete); // System.out.println("PS Created Successfully"); ps2.setString(1, "scan_2"); ps2.setInt(2, 2); // ps2.setInt(3, 5); ps2.executeUpdate(); System.out.println("first record deleted"); ps2.setString(1, "scan_2"); ps2.setInt(2, 5); ps2.executeUpdate(); System.out.println("second record deleted"); sqlSelect2="select * from vul_detail;"; stmt=conn.createStatement(); System.out.println("select query created"); ResultSet rs2 = stmt.executeQuery(sqlSelect2); I tried query as
sqlDelete = "delete from vul_detail where scanno=? and id=?,?"; PreparedStatement ps2=conn.prepareStatement(sqlDelete); System.out.println("PS Created Successfully"); ps2.setString(1, "scan_2"); ps2.setInt(2, 2); ps2.setInt(3, 5); ps2.executeUpdate(); I am getting exception in this please help