I have spent hours trying to make this work and have diligently read through the various posts but I just can't seem to get it. I have been using Spring JDBC for a long time, but not with Oracle stored procedures.
I have a stored procedure that requires one input parameter and contains an output parameter of type REF CURSOR. The procedure itself runs fine when I execute it within my database tool. I have tried various code permutations from the examples in the Spring documentation. Here is the latest:
In this code example 'this.jdbcCallTemplate' is an instance of SimpleJdbcCall that was injected into the ancestor class. 'projectId' is a parameter to the dao method call containing this code.
SimpleJdbcCall call = this.jdbcCallTemplate.
declareParameters(new SqlParameter("projectId", Types.NUMERIC)).
returningResultSet("data", new MyBeanMapper());
SqlParameterSource parm = new MapSqlParameterSource("projectId", projectId);
return (List) call.execute(parm);
I continue to receive a BadSqlGrammerException indicating 'wrong number or types of arguments in call'. I have tried leaving out the 'useInParameterNames' and 'declareParameters' methods, instead relying on the metadata lookup, but that doesn't make any difference. It seems that Oracle is simply not seeing the input parameter I'm supplying.
Any help is greatly appreciated.