本文介绍了如何在mybatis中调用oracle函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Mybatis调用Oracle函数,但尝试了不同的方法,但没有得到结果.请解决我的问题.

I want to call Oracle function using Mybatis i tried Different way but did not get result.please solve my issue.

 <select id="getNo" resultType="String" parameterType="map" statementType="CALLABLE">
begin
     #{retval, mode=OUT, jdbcType=VARCHAR}  = CALL pc_sys.f_get_no
     (
      #{notyp, mode=IN, jdbcType=VARCHAR},
     #{ymdDate, mode=IN, jdbcType=DATE}
     );
end;
 </select>

错误内容:

begin ? = CALL pc_sys.f_get_no ( ?, ? ); end;
java.sql.SQLException: ORA-06550: line 2, column 10:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
:= . ( @ % ; indicator
; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-06550: line 2, column 10:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
:= . ( @ % ; indicator.

推荐答案

在Java中

void getNo(Map<String,Object> mymap);

在Mapper.xml文件中

In Mapper.xml File

    <select id="getNo" resultType="String" parameterType="map" statementType="CALLABLE">
     #{retval, mode=OUT, jdbcType=VARCHAR}  = CALL pc_sys.f_get_no
     (
      #{notyp, mode=IN, jdbcType=VARCHAR},
     #{ymdDate, mode=IN, jdbcType=DATE}
     );
end;
 </select>

使用此代码,我解决了问题.

Using this code I solved my issue.

这篇关于如何在mybatis中调用oracle函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 09:25