title: Can I pass a list of String in the IN clause of sql statement(Oracle) using Java code
body: <p>Can I pass a list of String in the IN clause of sql statement(Oracle 12c) using Java code.</p>
  
  <p>My code is given below:</p>
  
  <pre><code>    Connection con= abc.getConnection();
      OracleConnection oracleConnection = null;
      OraclePreparedStatement ops=null;
      if (con.isWrapperFor(OracleConnection.class)){
             oracleConnection= con.unwrap(OracleConnection.class);  
          }else{
             // recover, not an oracle connection
          }
      PreparedStatement ps=oracleConnection.prepareStatement(sql);
      if (ps.isWrapperFor(OraclePreparedStatement.class)){
          ops= ps.unwrap(OraclePreparedStatement.class);  
          }else{
             // recover, not an oracle connection
          }
      List&lt;String &gt;Ids=new ArrayList&lt;String&gt;();
      Ids.add("12345");
      Ids.add("12346");
      java.sql.Array array1 = oracleConnection.createOracleArray("MY_NESTED_TABLE", Ids.toArray());
      ops.setArray(1, array1 );
      ResultSet rSet= ops.executeQuery();
  </code></pre>
  
  <p>I have defined my Oracle Nested Table as:</p>
  
  <p>create or replace <code>TYPE MY_NESTED_TABLE AS TABLE OF VARCHAR2(8 BYTE);</code></p>
  
  <p>And the sql queries I tried to execute are:</p>
  
  <ol>
  <li><code>SELECT * FROM MY_TABLE where MY_COLUMN IN (select column_value v from table(?))</code></li>
  <li><code>SELECT * FROM MY_TABLE where MY_COLUMN IN (select column_value v from table(cast(? AS MY_NESTED_TABLE)))</code></li>
  </ol>
  
  <p>There is no exception, just that I get no data in resultset.
  I have seen people using this code working with PL/SQL. Should it work with a SQL statement as well?</p>