Passing a list to a Java prepared statement

From: GMan (theusg_at_pweh.com)
Date: 10/06/04


Date: 6 Oct 2004 07:30:31 -0700

I'm using JDBC with Oracle 8i and I have the following prepared
statement code:

...

String sql = "Select ID from Users where level in (?)";

PreparedStatement statement = connection.prepareStatement(sql);

String levels = "1, 2, 3";

statement.setString(1, levels);

rs = (ResultSet) statement.executeQuery();

...

- The executeQuery call fails with: "ORA-01722: invalid number".
- Level is an integer field in the users table

So, I'm guessing I've got to do something different here to handle
these kinds of "list" parameters. Any thoughts?