首頁  >  問答  >  主體

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”附近有语法错误。
天蓬老师天蓬老师2712 天前739

全部回覆(1)我來回復

  • PHPz

    PHPz2017-04-18 10:56:52

    儲存程序報錯,直接把報錯的參數用來調試預存程序就知道什麼問題了

    回覆
    0
  • 取消回覆