java - mybatis,调用存储过程,“setselect”附近有语法错误。

查看:175
本文介绍了java - mybatis,调用存储过程,“setselect”附近有语法错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

mybatis,调用存储过程,setselect附近有语法错误。

<select id="getTrafficReportData" 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:\zngkpt\code\zngkpt\out\artifacts\highway_war_exploded\WEB-INF\classes\mapper\sqlserver\TrafficReportStatic.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附近有语法错误。

解决方案

存储过程报错,直接把报错的参数用来调试存储过程就知道什么问题了

这篇关于java - mybatis,调用存储过程,“setselect”附近有语法错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆