如何在Spring中调用存储过程来读取返回值和out参数?

时间:2021-12-15 20:13:38

I have a stored procedure which returns an Integer as well as an Out Parameter which is of type VARCHAR.

我有一个存储过程,它返回一个Integer以及一个类型为VARCHAR的Out参数。

I am using Spring 2.5.6 and unable to find a way to read the return value as well as Out Parameter at the same time.

我使用Spring 2.5.6并且无法找到同时读取返回值和Out参数的方法。

SimpleJdbcCall.executeFunction(..) have a facility to read the stored procedure return value but no facility for Out Parameter.

SimpleJdbcCall.executeFunction(..)具有读取存储过程返回值但没有Out参数设施的功能。

SimpleJdbcCall.execute(..) can read Out parameters.

SimpleJdbcCall.execute(..)可以读出Out参数。

There are other ways also in Spring to do the above.

在Spring中还有其他方法可以执行上述操作。

Am I missing something in Spring which can read both at the same time or the stored procedure is wrong as it should only use Out Param or Return Value but not both at same time?

我是否在Spring中遗漏了可以同时读取或存储过程错误的内容,因为它应该只使用Out Param或Return Value但不能同时使用两者?

1 个解决方案

#1


3  

If you are using Spring 2.5X, I believe that SimpleJdbcCall#withReturnValue() specifies that you want the return value to be included in the return results. I'm not sure what the entry will be keyed to in the Map, but I'd try that out.

如果您使用的是Spring 2.5X,我相信SimpleJdbcCall #withReturnValue()指定您希望返回值包含在返回结果中。我不确定这个条目在地图中会被键入什么,但我会尝试一下。

#1


3  

If you are using Spring 2.5X, I believe that SimpleJdbcCall#withReturnValue() specifies that you want the return value to be included in the return results. I'm not sure what the entry will be keyed to in the Map, but I'd try that out.

如果您使用的是Spring 2.5X,我相信SimpleJdbcCall #withReturnValue()指定您希望返回值包含在返回结果中。我不确定这个条目在地图中会被键入什么,但我会尝试一下。