i want to pass a list of values as a string to an IN clause in my Worklight 6.1 SQL Adapter:
SQL_Query= select * from USERS where name in (?);
i pass the following string as a param:
'john','mike','joe'
The call to the SQL procedure failed with the following error:
java.sql.SQLException: Invalid column index
So my question is: how to deal with IN params in a SQL Adapter?
The point was to use a length-variable parameter, as i don't know how many people to retrieve (the number depends on context).
Actually, it's not possible to do such with a PreparedStatement (JDBC). It can only be used with a Statement. Unfortunately, Worklight API does not propose statement but only preparedstatement.
The following is working, but i have to limit my search to 3 people:
SQL_Query= select * from USERS where name in (?,?,?);
or (dirty):
SQL_Query= select * from USERS where name = ? or name = ? or name = ?;