iBatis获取存储过程的返回值
sql.xml:
<parameterMap class="java.util.HashMap" id="AllocateResult">
<parameter property="city" jdbcType="VARCHAR2"
javaType="java.lang.String" mode="IN" />
<parameter property="agentCode" jdbcType="VARCHAR2"
javaType="java.lang.String" mode="IN" />
<parameter property="bcCode" jdbcType="VARCHAR2"
javaType="java.lang.String" mode="IN" />
<parameter property="id" jdbcType="NUMBER"
javaType="java.lang.Long" mode="IN" />
<parameter property="result" jdbcType="VARCHAR"
javaType="java.lang.String" mode="INOUT" />
</parameterMap>
<procedure id="DataAllocate_team_map"
parameterMap="AllocateResult">
call p_t_allocate(?,?,?,?,?)
</procedure>
java代码:
Map resultMap = new HashMap();
resultMap.put("city", ins.getCity());
resultMap.put("agentCode", ins.getAgentCode());
resultMap.put("bcCode", ins.getAgentCode());
resultMap.put("id", ins.getId());
resultMap.put("result", result);
getSqlMapClientTemplate().queryForMap("DataAllocate_team_map", resultMap, "AllocateResult");
result = (String) resultMap.get("result");
存储过程:
我不会写……总之返回的是个VARCHAR就是了。