title: From Java Passing Values as Array to Database Stored Procedure
body: <p>I have the following stored procedure in database</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE my_proc (
     my_array         IN     my_array_type,
     my_var    IN OUT VARCHAR2)
     ....
     ....
  </code></pre>
  
  <p>In Java I have the following code snippet to invoke the above stored procedure</p>
  
  <pre><code> public void callProc(String prodCode, 
                        String prodName, 
                        String prodDesc, 
                        ) {
              callableStatement = 
              this.getOADBTransaction().getJdbcConnection().prepareCall("{call my_proc (?,?)}");
      Object[] object = 
        new Object[] { prodCode, prodName, prodDesc};
  StructDescriptor structDescriptor = 
    StructDescriptor.createDescriptor("my_array_type",this.getOADBTransaction().getJdbcConnection());
  STRUCT struct = 
   new STRUCT(structDescriptor, this.getOADBTransaction().getJdbcConnection(), 
  object);
  STRUCT[] structArray = { struct };
  ArrayDescriptor arrayDescriptor = 
  ArrayDescriptor.createDescriptor("my_array",this.getOADBTransaction().getJdbcConnection());
  
  ARRAY array = 
  new ARRAY(arrayDescriptor, this.getOADBTransaction().getJdbcConnection(), 
  structArray);
  callableStatement.setArray(1, array);
  callableStatement.registerOutParameter(2, Types.VARCHAR);
  callableStatement.execute();
  ....
  </code></pre>
  
  <p>The above method is called from another class which is inside a for loop</p>
  
  <pre><code>for(....){
  
  Serializable[] param = 
  { prodCode, prodName, prodDesc};
  db.callProc(param )
  }
  </code></pre>
  
  <p>What I would like achieve is instead of calling db.callProc inside the for loop,
  I would like to use a ListArray or some other collection object and pass the value to db.callProc method and in db.callProc method I would like to iterate and pass to database procedure as an array so that my stored procedure can handle the array and do the processing.</p>