一、調用存儲過程
oracle代碼
procedure proc_pos_check(p_gtin in varchar2,
p_safe_code in varchar2,
p_in_sell_id in varchar2,
p_buy_id in varchar2,
p_oper_type in varchar2,
p_out_sell_id out varchar2,
p_result out varchar2)
sqlmap代碼
<sqlmap namespace="webservice_procheck">
<parametermap id="pro_check_req" class="java.util.hashmap">
<parameter property="p_gtin" javatype="java.lang.string" jdbctype="varchar" mode="in"/>
<parameter property="p_safe_code" javatype="java.lang.string" jdbctype="varchar" mode="in"/>
<parameter property="p_in_sell_id" javatype="java.lang.string" jdbctype="varchar" mode="in"/>
<parameter property="p_buy_id" javatype="java.lang.string" jdbctype="varchar" mode="in"/>
<parameter property="p_oper_type" javatype="java.lang.string" jdbctype="varchar" mode="in"/>
<parameter property="p_out_sell_id" javatype="java.lang.string" jdbctype="varchar" mode="out" />
<parameter property="p_result" javatype="java.lang.string" jdbctype="varchar" mode="out" />
</parametermap>
<procedure id="procheck" parametermap="pro_check_req">
{call pkg_pos.proc_pos_check(?,?,?,?,?,?,?)}
</procedure>
</sqlmap>
java代碼
public procheckqueryrsp procheck(procheckqueryreq procheckqueryreq)
{
procheckqueryrsp rsp = new procheckqueryrsp();
map<string, string> map = new hashmap<string, string>();
//拼裝存儲過程in參數
map.put("p_gtin", procheckqueryreq.getgtin());
map.put("p_safe_code", procheckqueryreq.getsecuritycode());
map.put("p_in_sell_id", procheckqueryreq.getsellerid());
map.put("p_buy_id", procheckqueryreq.getbuyerid());
map.put("p_oper_type", procheckqueryreq.getopertype());
//拼裝存儲過程out參數
map.put("p_out_sell_id", "");
map.put("p_result", "");
//調用存儲過程
dboperation.queryforobject("webservice_procheck.procheck", map);
//将out值存入實體類中
rsp.setsellerid(map.get("p_out_sell_id"));
rsp.setresult(map.get("p_result"));
return rsp;
}
二、調用function
create or replace function f_createalarminfoinstancename(v_instancename in varchar2, v_almobjtype in varchar2, v_almobj in varchar2)
return varchar2
is
v_err varchar2(200);
result varchar2(10);
begin
result:='1';
update alm_alarminfo set instancename = v_instancename where alarmobjdn = v_almobj and alarmobjtype = v_almobjtype;
commit;
return result;
end f_createalarminfoinstancename;
<parametermap class="java.util.map" id="f_map">
<parameter property="result" jdbctype="varchar" javatype="java.lang.string" mode="out" />
<parameter property="v_instancename" jdbctype="varchar" javatype="java.lang.string" mode="in"/>
<parameter property="v_almobjtype" jdbctype="varchar" javatype="java.lang.string" mode="in"/>
<parameter property="v_almobj" jdbctype="varchar" javatype="java.lang.string" mode="in"/>
</parametermap>
<procedure id="workorder.updatealarminfoinstance" parametermap="f_map">
<![cdata[
{? = call f_createalarminfoinstancename(?,?,?)}
]]>
</procedure>
map m = new hashmap();
m.put("v_instancename", instancename);
m.put("v_almobjtype", alarmobjtype);
m.put("v_almobj", alarmobjdn);
m.put("result", "");
service.update("workorder.updatealarminfoinstance", m);
原帖位址:
http://blog.csdn.net/liuyuhua0066/article/details/7270253
http://blog.csdn.net/haqer0825/article/details/8751989