Skip to content

TVP Handling is causing exception when calling SP with return value #80

@bergerdenes

Description

@bergerdenes

When the SQLServerCallableStatement is called with prepareCall("{call SPNAME}") and Structured parameter is added to the statement, the call is successful.
However when the caller would need the return value from the call, that is prepareCall("{? = call SPNAME}") is used (with the first parameter placeholder for the return value) and also this is registered with registerOutParameter(1, Types.INTEGER), the execution of the statement fails because the SQLServerParameterMetaData class in the driver tries to get a nonexisting row from the sp_sproc_columns call result (to determine the TVP name from the database with this internal sp call).
The erroneus line is in the SQLServerParameterMetaData.verifyParameterPosition method, when calling the rsProcedureMeta.absolute(param+1). Here the +1 should be checked and added only if there is no return value parameter expected.

Metadata

Metadata

Assignees

Labels

Under ReviewUsed for pull requests under review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions