1.存储过程
declare
status varchar2(100);
message varchar2(100);
begin
test_func(1,status,message );
dbms_output.put_line(status);
dbms_output.put_line(message );
end;
2.配置文件
<select id="test_func" parameterType="java.util.Map" statementType="CALLABLE">
{call test_func(
#{id,mode=IN,jdbcType=INTEGER}
,#{status,mode=OUT,jdbcType=VARCHAR}
,#{message,mode=OUT,jdbcType=VARCHAR})}
</select>
3.java代码
@Override
public Map<String, Object> testFunc(PlnJitRequisitionsParam param){
// TODO Auto-generated method stub
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", param.getRequisitionId());
this.st_fnd.selectOne(this.statement("test_func"), map);
return map;
}
本文介绍了一个使用Oracle存储过程与MyBatis框架交互的案例,演示了如何在Java代码中通过MyBatis调用存储过程,并传递参数进行数据操作。涉及存储过程的声明、参数设置及结果输出,以及MyBatis配置文件中的CallableStatement配置。
2201

被折叠的 条评论
为什么被折叠?



