title: Calling StoredProcedure with Oracle Plsq Index-Table in Java: Alternatives to deprecated set/getPlsqlIndexTable do not work
body: <p>I am trying to call a simple Oracle Stored-Procedure that takes a plsql-index-table and retursn a plsql-index-table as OUT parameter.
  My old approach works perfectly but the methods I used there are deprectad now. That was my old Approach:</p>
  <pre><code>    OracleConnection oracleConnection = connection.unwrap(OracleConnection.class);
      CallableStatement callableStatement = oracleConnection.prepareCall(&quot;BEGIN STORED_PROC_IBT_PACKAGE.SIMPLE_INANDOUT_NUMBER_DEC(?,?); END;&quot;);
      OracleCallableStatement oracleCallableStatement = callableStatement.unwrap(OracleCallableStatement.class);
      BigDecimal[] input = new BigDecimal[] {BigDecimal.valueOf(1), BigDecimal.valueOf(2),BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO,
              BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO};
      
      oracleCallableStatement.setPlsqlIndexTable(1, input,10, input.length,Types.DECIMAL, 10);
      oracleCallableStatement.registerIndexTableOutParameter(2, 10, Types.DECIMAL, 10);
      
      oracleCallableStatement.execute();
      
      BigDecimal[] plsqlIndexTable = (BigDecimal[])oracleCallableStatement.getPlsqlIndexTable(2);
      Arrays.stream(plsqlIndexTable).forEach(System.out::println);
  </code></pre>
  <p>I am not sure if my new approach is correct by using an array and using 'setObject', 'getObject' and 'createOracleArray' but it works nearly perfect. My new approach:</p>
  <pre><code>    OracleConnection oracleConnection = connection.unwrap(OracleConnection.class);
      CallableStatement callableStatement = oracleConnection.prepareCall(&quot;BEGIN STORED_PROC_IBT_PACKAGE.SIMPLE_INANDOUT_NUMBER_DEC(?,?); END;&quot;);
      OracleCallableStatement oracleCallableStatement = callableStatement.unwrap(OracleCallableStatement.class);
      BigDecimal[] input = new BigDecimal[] {BigDecimal.valueOf(1), BigDecimal.valueOf(2),BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO,
              BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO};
      
      oracleCallableStatement.setObject(1, oracleConnection.createOracleArray(&quot;DBACCESSTESTDB.STORED_PROC_IBT_PACKAGE.NUMBER_TABLE_INDEX&quot;, input));
      oracleCallableStatement.registerOutParameter(2, Types.ARRAY, &quot;DBACCESSTESTDB.STORED_PROC_IBT_PACKAGE.NUMBER_TABLE_INDEX&quot;);
  
      oracleCallableStatement.execute();
  
      Array plsqlIndexTable = (Array)oracleCallableStatement.getObject(2);
      BigDecimal[] results = (BigDecimal[])plsqlIndexTable.getArray();
      Arrays.stream(results).forEach(System.out::println);
  </code></pre>
  <p>The problem with new approach is that only 9 elements come back instead of 10. The reasons seams to be that the first element (in Java with index 0) is lost somewhere. I don't no if it is lost when sending in to the Stored-Proceudure or when retrieving it. Is this an Oracle Bug or is my new approach somehow wrong?</p>
  <p>Edit: Okay now I know that the problems occurs when sending the array to the storedProcedure. When I use the old approach with &quot;setPlsqlIndexTable&quot; for setting the IN-parameter and the new approach ('registerOutParameter' and 'getObject') for retrieving the OUT-parameter it works.
  But I still not know how to fix the problem. Still the first element of the array is lost</p>