2016-07-14 76 views
0

我得到同時調用Oracle函數下面的錯誤......春天的MyBatis甲骨文函數調用

org.springframework.jdbc.UncategorizedSQLException: 
### Error querying database. Cause: java.sql.SQLException: Non supported SQL92 token at position: 1: 
### The error may exist in file [C:\Users\pkr\rpt\bin\dbmappers\MyMapper.xml] 
### The error may involve com.pkr.tpy.rpt.dao.MyDao.resetRecs-Inline 
### The error occurred while setting parameters 
### SQL: { ? = call actions.reset_recs(?,     ?,     ?,     ?) } 
### Cause: java.sql.SQLException: Non supported SQL92 token at position: 1: 
; uncategorized SQLException for SQL []; SQL state [99999]; error code [17034]; Non supported SQL92 token at position: 1: ; nested exception is java.sql.SQLException: Non supported SQL92 token at position: 1: 
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84) 
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) 
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) 
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) 
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447) 
    at com.sun.proxy.$Proxy37.selectOne(Unknown Source) 

這裏是我的mapper.xml

<select id="resetRecs" resultType="String" statementType="CALLABLE"> 
    { 
    #{retVal,mode=OUT,jdbcType=VARCHAR} = call actions.reset_recs(#{xCode, jdbcType=DECIMAL,mode=IN}, 
           #{yCode,jdbcType=DECIMAL,mode=IN}, 
           #{xyzNum,jdbcType=DECIMAL,mode=IN}, 
           #{src,jdbcType=VARCHAR,mode=IN}) 
    }  
</select> 

DAO Interface: 

String resetRecs(@Param("xCode") int xCode, 
      @Param("yCode") int yCode, 
      @Param("xyzNum") int xyzNum, @Param("xyzSrc") String xyzSource, 
      @Param("retVal") String retVal); 

我使用的MyBatis 3.4.0 , 任何幫助將不勝感激。

回答

1

我在一行更新映射器調用語句時能解決這個問題。

<select id="resetRecs" resultType="String" statementType="CALLABLE"> 
{#{retVal,mode=OUT,jdbcType=VARCHAR} = call actions.reset_recs(#{xCode, jdbcType=DECIMAL,mode=IN},#yCode,jdbcType=DECIMAL,mode=IN},#xyzNum,jdbcType=DECIMAL,mode=IN},#{src,jdbcType=VARCHAR,mode=IN})}