Is it a wrong usage of Prepared statement? ( Database is Oracle 9i)
Yes. You can't do what you're trying to do. There is no way, no workaround, nada, zip, nothing. (There are a very very few DBs/drivers where this will actually work, but Oracle has never been one of them and it's really not supposed to work.)
The ? fields in a SQL statement are for binding values; the binding occurs quite late, long after the SQL has been parsed from a text string into some sort of internal representation. An expression list, like ('a','b','c'), is not a value, but as its name implies, is a list of expressions that will be resolved to a list of values. Most of that resolution normally occurs during parse, long before binding. In other words, the ? fields are not set via string relacement...
Joined: Jan 24, 2006
Thanks for the clarification.
subject: PreparedStatement - NOT IN (?) is mis-behaving