Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
333 views
in Technique[技术] by (71.8m points)

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: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”附近有语法错误。

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...