java - mybatis,调用存储过程,“setselect”附近有语法错误。
问题描述
mybatis,调用存储过程,“setselect”附近有语法错误。
<select resultMap='BaseResultMap' parameterType='com.unisits.zngkpt.framework.highwayreport.pojo.ReportType' statementType='CALLABLE'> {call Get_TrafficData_Report ( #{reportTimeType,mode=IN,jdbcType=VARCHAR},#{reportFunction,mode=IN,jdbcType=VARCHAR},#{year,mode=IN,jdbcType=INTEGER},#{month,mode=IN,jdbcType=INTEGER},#{day,mode=IN,jdbcType=INTEGER},#{tunnelId,mode=IN,jdbcType=INTEGER} )}</select>
把参数直接改成 ’Day’, ’JTLL’, 2015, 06, 15, 0就没有问题。
完整log
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: ### Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: “setselect”附近有语法错误。### The error may exist in file [D:zngkptcodezngkptoutartifactshighway_war_explodedWEB-INFclassesmappersqlserverTrafficReportStatic.xml]### The error may involve com.unisits.zngkpt.framework.highwayreport.mapper.TrafficReportDao.getTrafficReportData-Inline### The error occurred while setting parameters### SQL: {call Get_TrafficData_Report ( ?, ?, ?, ?, ?, ? )}### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: “setselect”附近有语法错误。
问题解答
回答1:存储过程报错,直接把报错的参数用来调试存储过程就知道什么问题了
相关文章:
1. java - Mybatis查询数据库时出现查询getInt()的错误2. java - mybatis执行sql求和问题3. java - mybatis的注解sql怎么设置返回类型和查询参数,比如我要返回一个封装好的类里面有map属性的4. java - mybatis怎么实现在数据库中有就修改,没有就添加5. java - mybatis mysql 如何实现upsert功能?6. java - mybatis怎么处理事务问题7. java - mybatis查询的时间与mysql的时间不一致?8. java - Mybatis:Mybatis能否直接返回一个二维数组(表)9. java - Mybatis 参数类型问题,应该是Map,结果报错.10. java - mybatis 插入数据到oracle,id无法用selectkey获取到数据