数据库脚本(注意if end if 这种格式)
create or replace package body pmp_agnt_public_pkg as PROCEDURE fix_contract (p_agreement_no VARCHAR2, -- 入参 p_error OUT VARCHAR2) AS -- 出参 v_agreement_id number; -- 声明变量 ....... BEGIN; SELECT COUNT(*) INTO v_cnt03 FROM TSE_AGREEMENT_INFO_NEW t WHERE t.bussiness_type = '422' AND t.agreemen_no = p_agreement_no; IF v_cnt03 = 0 THEN p_error := '你所输的不是区域代理合同编号,请确认后再输'; -- 返回值 RETURN; END IF; ........... END; END fix_contract; end pmp_agnt_public_pkg;
xml文件:注意jdbcType=VARCHAR,被狠狠坑了一嗲
<update id="fixContract" statementType="CALLABLE"> {call pmp_agnt_public_pkg.fix_contract(#{p_agreement_no,mode=IN,jdbcType=VARCHAR},#{p_error,mode=OUT,jdbcType=VARCHAR})} </update>
怎么调用xml:入参用map封装,出参用map.get("");
public String fixContract(String agreementNo) { Map<String, String> map = new HashMap<String, String>(); map.put("p_agreement_no", agreementNo); dao.update("fixContract", map); return map.get("p_error"); }
END!