I want to execute stored procedure with dynamic parameters with SimpleJdbcCall. In total I have 6 optional parameters in SQL server SP, out of them I must be able to pass any or none. My SP executes fine as expected in MS Studio. But not by SimpleJdbcCall. I tried in many ways and one of them I tried is withNamedBinding. But it gives Input Syntax error near "=" as below.
this.simpleJdbcCall = new SimpleJdbcCall(jdbcTemplateObject)
.withNamedBinding()
.withSchemaName("dbo")
.withProcedureName("EmployeeDetails")
.useInParameterNames(
paramNameArray)
.returningResultSet("detailReportData", BeanPropertyRowMapper.newInstance(Employee.class));
Map<String,Object> out = this.simpleJdbcCall.execute(sqlSource);
Log:
2019-01-31 18:14:49 DEBUG SimpleJdbcCall:405 - The following parameters are used for call {call dbo.EmployeeDetails(empCode => ?, empName => ?, empLoc => ?)} with {empCode=0, empName='hgkghdkgf', empLoc='kjhjk'} 2019-01-31 18:14:49 DEBUG DispatcherServlet:993 - Could not complete request org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call dbo.EmployeeDetails(empCode => ?, empName => ?, empLoc => ?)}]; SQL state [S0001]; error code [102]; Incorrect syntax near '='.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '='.