【发布时间】:2018-05-25 02:12:32
【问题描述】:
我正在尝试从 Oracle 存储过程中获取数据。问题是在我们的数据库中有一个函数和一个过程具有相同的名称和相同的参数。
当我尝试调用它时:
@Autowired
public void setDataSource (@Qualifier("dataSource") DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.setResultsMapCaseInsensitive(true);
this.functionGetSomeCode = new SimpleJdbcCall(jdbcTemplate)
.declareParameters(new SqlOutParameter("RETURN", OracleTypes.NUMBER))
.withFunctionName("get_some_code").withSchemaName("XXX").withCatalogName("some_pkg");
}
public Integer getSomeCode (String incoming) {
SqlParameterSource incomingParameters = new MapSqlParameterSource().addValue("incoming", incoming);
return functionGetSomeCode.executeFunction(Integer.class, incomingParameters);
}
我得到一个例外:
springframework.dao.InvalidDataAccessApiUsageException: Unable to determine the correct call signature - multiple procedures/functions/signatures
有没有办法在不要求 DBA 将函数/过程重命名为其他名称的情况下处理这种情况?
【问题讨论】:
标签: java spring oracle stored-procedures