Reputation: 35
How can I pass a parameter in the IN SQL statement ?
cursor = readableDb.rawQuery("SELECT * FROM User where User.objectId NOT IN (@Par)", new String{"ID"} );
Is it the correct way to do it ?
Upvotes: 1
Views: 80
Reputation: 152817
Variables get bound with a single literal value. If you have many values, you need a separate ?
placeholder for each.
Example:
cursor = readableDb.rawQuery("SELECT * FROM User where objectId NOT IN (?,?,?)",
new String[] { "1", "2", "3" });
Upvotes: 1