Thursday, 8 August 2013

java.sql.SQLException: [ProvideX][ODBC Driver]Invalid operand for operator: IN

java.sql.SQLException: [ProvideX][ODBC Driver]Invalid operand for
operator: IN

I have been trying to query the database using the MAS90 odbc driver, only
to encounter the below error.
java.sql.SQLException: [ProvideX][ODBC Driver]Invalid operand for
operator: IN at
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957) at
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114) at
sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110) at
sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338) at
sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:2 53)
Here is the query i am using,
Select orderno,Date,location, price from Orders where orderno IN
(2220,2221,2222.....3200);
(note: i have about about 900 order numbers in the list to choose from).
the query runs fine when i try it in the Microsoft Sql studio express with
10 or 20 order numbers, but when i try to do the same in the code, it
fails with the Invalid operand for operator IN error!!
FYI, i am trying to reduce the number of queries to the database hence the
decision to use the IN keyword (with 900 order number to choose from).
could you also tell me if this is the right approach?
This was the only solution i could think of to drastically reduce the
number of queries to the database.

No comments:

Post a Comment