java - mybatis,調(diào)用存儲過程,“setselect”附近有語法錯誤。
問題描述
mybatis,調(diào)用存儲過程,“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>
把參數(shù)直接改成 ’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:存儲過程報錯,直接把報錯的參數(shù)用來調(diào)試存儲過程就知道什么問題了
相關(guān)文章:
1. java - Mybatis關(guān)聯(lián)查詢2. java - Mybatis 參數(shù)類型問題,應該是Map,結(jié)果報錯.3. java - mybatis mysql 如何實現(xiàn)upsert功能?4. java - Mybatis:Mybatis能否直接返回一個二維數(shù)組(表)5. java - mybatis 插入數(shù)據(jù)到oracle,id無法用selectkey獲取到數(shù)據(jù)6. java - mybatis查詢的時間與mysql的時間不一致?7. java - mybatis執(zhí)行sql求和問題8. java - mybatis里的REGEXP9. java - Mybatis 一對多怎么映射10. java - Mybatis插入mysql數(shù)據(jù)庫返回自增主鍵的問題?
