I am getting a bit lost, Trying to improve efficiency of my delete
statements, which has an IN selection, and an id int  primary key.

In the manual it has:

PreparedStatement prep = conn.prepareStatement(
    "SELECT * FROM TABLE(X INT=?) T INNER JOIN TEST ON T.X=TEST.ID");
prep.setObject(1, new Object[] { "1", "2" });
ResultSet rs = prep.executeQuery();


and on a search with Google i found a message from Tom:

PreparedStatement prep = conn.prepareStatement(
  "SELECT * FROM users WHERE login IN (?)");
prep.setObject(1, new Object[] { "1", "2" });
ResultSet rs = prep.executeQuery();


but in my delete query I get an exception:

org.h2.jdbc.JdbcSQLException: Data conversion error converting "(1,
2)"; SQL statement:
Caused by: java.lang.NumberFormatException: For input string: "(1, 2)"
        at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:
48)
        at java.lang.Long.parseLong(Long.java:410)
        at java.lang.Long.parseLong(Long.java:468)
        at org.h2.value.Value.convertTo(Value.java:796)


I am trying to filter on an attribute which has an id, of type int.

I have tried

                ps1.setObject(1, new Object[]{new Integer(1),new
Integer(2)});

and
                 ps1.setObject(1, new Integer[]{1,2});

no joy.

My prepared statement is:

                ps1 = connection.prepareStatement("delete from
doublearray where doublearray.wellresultid IN (?)");

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to