一、调用存储过程
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
Oracle代码
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;
SqlMap代码
<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>
Java代码
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