PreparedStatement and IN Operator ???

From: Frank (Frank.Martens_no!spamx!xmm_at_Bertelsmann.de)
Date: 06/16/04


Date: Wed, 16 Jun 2004 13:36:17 +0200

Hi ng,

i created a SQL statement that uses the IN operator.
How can i use that statement in a PreparedStatement?

SELECT FROM USER WHERE NAME IN (?)

Which setter do i have to use for a list like e.g.
? = 'Smith', 'Wesson'

ps.setString(1, "'Meier', 'Müller'") doesn't work, that would bei
SELECT FROM USER WHERE NAME IN (''Meier', 'Müller'')

Can i use setArray()?

Frank



Relevant Pages

  • Re: PreparedStatement problem
    ... A SQL statement is precompiled and stored in a PreparedStatement ... one query plan for a PreparedStatment, ... ....then DB makes a query plan for it via its DB compiler and keep ...
    (comp.lang.java.programmer)
  • Re: PreparedStatement and IN Operator ???
    ... > i created a SQL statement that uses the IN operator. ... > How can i use that statement in a PreparedStatement? ... JDBC drivers may support alternate forms or setArray(). ... FirstSQL/J Object/Relational DBMS ...
    (comp.lang.java.databases)
  • Re: PreparedStatement problem
    ... "...An object that represents a precompiled SQL statement. ... A SQL statement is precompiled and stored in a PreparedStatement ... who compiles? ...
    (comp.lang.java.programmer)
  • Re: PreparedStatement problem
    ... "...An object that represents a precompiled SQL statement. ... A SQL statement is precompiled and stored in a PreparedStatement ... With proper JDBC support, the DBMS. ...
    (comp.lang.java.programmer)
  • Re: Repeated SQL and ResultSet in a method
    ... You should/could use prepared statements and bind variables. ... Make a PreparedStatement, bind variables to it, and use the same prepared ... saves LOTS of resources and processor time ... Change only data, not the SQL statement. ...
    (comp.lang.java.programmer)