mybatis调用Oracle存储过程

存储过程

CREATE OR REPLACE PROCEDURE proc_test1(p_id             IN NUMBER,
                                       p_result_code    OUT NUMBER,
                                       p_result_message OUT VARCHAR2) AS
BEGIN

  p_result_message := '成功';
  p_result_code    := '1';

END;

调用测试

Mapper.xml

    <select id="proc_test1" parameterType="Map" statementType="CALLABLE">
  	 	{call proc_test1(
  			#{p_id,jdbcType=DECIMAL,mode=IN},
  			#{p_result_code,jdbcType=DECIMAL,mode=OUT},
  			#{p_result_message,jdbcType=VARCHAR,mode=OUT}
  		)}
    </select>

Mapper 

    void proc_test1(Map map);

 调用测试

    @Autowired
    private TestMapper testMapper;
    
    @Test
    public void proc_test1() {

        Map map=new HashMap();
        testMapper.proc_test1(map);

        System.out.println(map);
        System.out.println(JSON.toJSONString(map));
    }

结果

posted @ 2021-08-25 14:17  天天代码码天天  阅读(29)  评论(0编辑  收藏  举报  来源