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:存儲過程報(bào)錯,直接把報(bào)錯的參數(shù)用來調(diào)試存儲過程就知道什么問題了
相關(guān)文章:
1. java - mybatis mysql 如何實(shí)現(xiàn)upsert功能?2. java - mybatis的注解sql怎么設(shè)置返回類型和查詢參數(shù),比如我要返回一個封裝好的類里面有map屬性的3. java - mybatis 插入數(shù)據(jù)到oracle,id無法用selectkey獲取到數(shù)據(jù)4. java - Mybatis:Mybatis能否直接返回一個二維數(shù)組(表)5. java - mybatis執(zhí)行sql求和問題6. java - Mybatis關(guān)聯(lián)查詢7. java - mybatis怎么處理事務(wù)問題8. java - mybatis里的REGEXP9. java - Mybatis映射問題10. java - mybatis源碼分析
