Announcement Announcement Module
Collapse
No announcement yet.
Oracle function call fails Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Oracle function call fails

    Hi!

    We are using Oracle Database and this function call:
    Code:
    	m_translateProc = createFunc("OUR_FUNCTION");
    	m_translateProc.addDeclaredRowMapper("p_result", new RowMapper<FooResult>() {...});
    
    ...
    	MapSqlParameterSource params;
    	params = new MapSqlParameterSource();
    	params.addValue("p_aaa", bar);
    	params.addValue("p_bbb", foo);
    	result = m_translateProc.execute(params);
    
    ////
    SimpleJdbcCall createFunc(String procedureName)
    {
    	SimpleJdbcCall jdbcCall;
    		
    	jdbcCall = new SimpleJdbcCall(m_dataSource).withFunctionName(procedureName);
    	if(m_dataBaseCatalog!=null) {
    		jdbcCall.withCatalogName(m_dataBaseCatalog);
    	}
    	if(m_dataBaseSchema!=null) {
    		jdbcCall.withSchemaName(m_dataBaseSchema);
    	}
    	
    	return jdbcCall;
    }
    The execute() call throws a org.springframework.jdbc.UncategorizedSQLException :
    CallableStatementCallback; uncategorized SQLException for SQL [{? =
    call TEST_FOO.OUR_FUNCTION()}]; SQL state [99999]; error code
    [17041]; Missing IN or OUT parameter at index:: 1; nested exception is
    java.sql.SQLException: Missing IN or OUT parameter at index:: 1

    Any idea why is that happening?
    Normally, if a parameter is omitted in Java code, the error is org.springframework.dao.InvalidDataAccessApiUsageE xception: Required input parameter 'P_FOOBAR' is missing

    Is it something with the implicit output parameter of the function?

    Aha, now I read http://static.springsource.org/sprin...ence/jdbc.html and see they use executeFunction()

    Is that it? (it is hard for me to test, as we have a bit of ... distributed environment).

    Regards,
    David
Working...
X