Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:46:28+00:00 2026-05-29T11:46:28+00:00

I am trying to call a stored function on an oracle database with spring-jdbc.

  • 0

I am trying to call a stored function on an oracle database with spring-jdbc.

This is the stored function I am trying to call:

FUNCTION GET_RESOURCE_LIST RETURN RESOURCE_TAB;

Next is the definition of resource_tab

TYPE RESOURCE_TAB AS TABLE OF TRESOURCE;

Next is the definition of tresource

TYPE TRESOURCE AS OBJECT(
RESOURCE_ID NUMBER(10,0),
RESOURCE_NAME VARCHAR2(100)
)

The calling 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<String> resources = call.executeFunction(Collection.class);

Last is the stack trace that I am receiving:

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
> 
    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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:46:30+00:00Added an answer on May 29, 2026 at 11:46 am

    I have the same problem, and I spent a day to fix it.
    Thinking about error “Image is a collection image”, instead of

    OracleTypes.STRUCT it must be OracleTypes.ARRAY.

    About your getTypeValue(…) method I can’t say is it right or not, but I will show how parse the resultset (maybe it is and other way, please write it):

    @Override
    public Object getTypeValue(CallableStatement cs, int paramIndex,
            int sqlType, String typeName) throws SQLException {
    
        ARRAY struct = (ARRAY) cs.getObject(paramIndex);
    
        ResultSet rs = struct.getResultSet();
    
        while (rs.next()) {
            Object rowIndex = rs.getObject(1);
            oracle.sql.STRUCT row = (oracle.sql.STRUCT) rs.getObject(2);
            if (row != null) {
                Object[] cols = row.getAttributes();
                System.out.print(rowIndex + ": ");
                for (Object col : cols) {
                    System.out.print(col + " ");
                }
                System.out.println();
            }
        }
    
        return "construct your data structure above and return here";
    }
    

    the another way is

        @Override
    public Object getTypeValue(CallableStatement cs, int paramIndex,
            int sqlType, String typeName) throws SQLException {
    
        ARRAY array = (ARRAY) cs.getObject(paramIndex);
    
        Object[] rows = (Object[])array.getArray();
    
        for(Object row : rows){
            Object[] cols = ((oracle.sql.STRUCT)row).getAttributes();
            for (Object col : cols) {
                System.out.print(col + " ");
            }
            System.out.println();
    
        }
    
        return "construct your data structure above and return here";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to convert the following stored proc to a LinqToSql call (this
I am trying to call a legacy stored function in an Oracle9i DB from
I am trying to call a stored procedure over a database link. The code
Has anyone seen this error when trying to call an external C function from
I'm trying to call an Oracle Stored Procedure which returns XMLType data, but all
This is a homework question. I'm trying to call a function of the form
I'm getting a 1064 error when trying to call a stored function from within
Am trying to get linq to call a stored procedure. I know this is
I'm trying to call a stored procedure (on a SQL 2005 server) from C#,
I am trying to call the stored procedure using subsonic and getting Object Reference

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.