title: Internal Error: Image is a collection image,expecting ADT with Oracle
body: <p>I am trying to call a stored function on an oracle database with spring-jdbc.  </p>
  
  <p>This is the stored function I am trying to call:</p>
  
  <pre><code>FUNCTION GET_RESOURCE_LIST RETURN RESOURCE_TAB;
  </code></pre>
  
  <p>Next is the definition of resource_tab</p>
  
  <pre><code>TYPE RESOURCE_TAB AS TABLE OF TRESOURCE;
  </code></pre>
  
  <p>Next is the definition of tresource</p>
  
  <pre><code>TYPE TRESOURCE AS OBJECT(
  RESOURCE_ID NUMBER(10,0),
  RESOURCE_NAME VARCHAR2(100)
  )
  </code></pre>
  
  <p>The calling code</p>
  
  <pre><code>final SimpleJdbcCall call = new SimpleJdbcCall(idmJdbcTemplate).withFunctionName("get_resource_list").declareParameters(new SqlOutParameter(
          "RETURN", OracleTypes.STRUCT,
          "RESOURCE_TAB",
          new SqlReturnType() {
  
            @Override
            public Object getTypeValue(CallableStatement cs, int paramIndex, int sqlType, String typeName) throws SQLException {
              final Struct s = (Struct)cs.getObject(paramIndex);
              final Object[] attr = s.getAttributes();
              return attr[1];
            }             
          }));
  
  call.compile();
  final Collection&lt;String&gt; resources = call.executeFunction(Collection.class);
  </code></pre>
  
  <p>Last is the stack trace that I am receiving:</p>
  
  <pre><code>org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{? = call WVUID.IDM_REPO_MANUAL.GET_RESOURCE_LIST()}]; SQL state [99999]; error code [17001]; Internal Error: Image is a collection image,expecting ADT; nested exception is java.sql.SQLException: Internal Error: Image is a collection image,expecting ADT
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:969)
      at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
      Truncated. see log file for complete stacktrace
  
  Caused By: java.sql.SQLException: Internal Error: Image is a collection image,expecting ADT
      at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
      at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
      Truncated. see log file for complete stacktrace
  &gt; 
      at org.springframework.jdbc.core.JdbcTemplate$5.doInCallableStatement(JdbcTemplate.java:1015)
      at org.springframework.jdbc.core.JdbcTemplate$5.doInCallableStatement(JdbcTemplate.java:1)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:953)
      ... 62 more
  </code></pre>