存储过程
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | PROCEDURE P_TEST_MYBATIS(iv_ins1 IN VARCHAR2, --id iv_ins2 IN VARCHAR2, --no ov_res OUT number --提示信息 ) IS BEGIN ov_res := 0; select count (1) into ov_res from jc_zhiydoc t where t.zhiy_id = iv_ins1 and t.zhiy_no = iv_ins2; EXCEPTION WHEN OTHERS THEN RAISE; END ; |
mapper.xml
这里我是在pkg_ck_task包下面的存储过程
1 2 3 4 5 6 7 8 | < select id = "exec" statementtype = "CALLABLE" > call pkg_ck_task.P_TEST_MYBATIS( #{iv_ins1}, #{iv_ins2}, #{ov_res,jdbcType=INTEGER,mode=OUT} ) </ select > |
dao层
1 2 | void exec(Map<string> params); </string> |
调用
1 2 3 4 5 6 7 8 9 | public int exec(){ Map<string> map = new HashMap(); map.put( "iv_ins1" , "ZIY00007709" ); map.put( "iv_ins2" , "0103" ); mapper.exec(map); int res = ( int )map.get( "ov_res" ); return res; } </string> |
结果:
到此这篇关于mybatis 调用 Oracle 存储过程 并接受返回值 _的文章就介绍到这了,更多相关mybatis 调用 Oracle 存储过程内容请搜索IT俱乐部以前的文章或继续浏览下面的相关文章希望大家以后多多支持IT俱乐部!