This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

Return value of stored procs using StoredProcedure class and not SimpleJdbcCall.Page Title Module

Return value of stored procs using StoredProcedure class and not SimpleJdbcCall.

Mar 13th, 2012, 07:47 AM

Hi,
I am using Spring 3.1.1 . I would like to konw how I can retrieve a return value from a stored proc. My stored proc returns errorcodes. I have read that this can be done using SimplejdbcCall, but I want to avoid doing this. I am more inclined to use Spring StoredProcedure class. It has provision for IN and OUT parameters but cant seem to find a way to get return value. Can return value to retrieved using StoredProcedure class? If not, Is SimpleJdbcCall the only way to retrieve stored proc return values or can this be done in any other way.

Ok fixed this. For others encountering the same problem, Here is the solution . use setFunction(true) and declare the return param as the first parameter as shown below. The name of the param should be same as the name of the return variable in the stored proc, though I am not very sure about this. Then the return parameter can be accessed as any other out parameter in the return Map.