The substituted values get quoted, so the query actually will read as
SELECT DISTINCT city FROM UsaZipCode WHERE statecode = 'NJ' AND county IN ('Morris,Essex') AND citytype = 'D' ORDER BY city;
(note the position of the quotes in the substitution of the second '?')
This explains why a single element works.
Thanks a lot for your response. It explains why a single value works.
I am not sure how should I get past this issue. I would really like to pass a comma separated list of counties. I guess I can play with the positioning of the quotes in my strings.
Do you have any suggestions?
Once again, thanks for a quick response.
If any one is interested and facing a similar situation, I got around this issue by using the JBoss dynamic SQL.