mybatis - Spring Mybatis Oracle函数调用

标签 mybatis ibatis spring-mybatis

我在调用 oracle 函数时遇到以下错误...

    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,任何帮助将不胜感激。

最佳答案

当我在一行中更新我的映射器调用语句时,我能够解决这个问题。

<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})}      

关于mybatis - Spring Mybatis Oracle函数调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38382089/

相关文章:

java - 通过mybatis进行映射

java - MyBatis ORA-01745 : invalid host/bind variable name

java - 如何在IBATIS中的iterate中使用select语句?

mybatis - 如何为 mybatis-spring-boot 映射 EnumOrdinalTypeHandler?

java - 带有 spring-mybatis 的 spring-boot - 如何强制它记录所有 SQL 查询

java - MyBatis - 缓存刷新后不更新嵌套结果

java - MyBatis 与 Spring : Could not find result map

java - 为什么mybatis强制打印log4j DEBUG信息到控制台

java - iBATIS 将存储过程输出参数设置回 POJO

MySQL获取位于两个不同列中的键值对