日期:2014-05-19 浏览次数:20639 次
create or replace procedure pro_dept(dname in varchar2,cur_sys out sys_refcursor)
is
begin
open cur_sys for select * from dept where dname like '%||dname||%';
end;
<resultMap type="Dept" id="getDept">
<id column="deptno" property="deptno"/>
<result column="dname" property="dname"/>
<result column="loc" property="loc"/>
</resultMap>
<!-- 调用存储过程返回结果集 -->
<select id="callProcedure1" parameterType="java.util.Map">
<![CDATA[
call getuserby(#{dname,mode=IN,jdbcType=VARCHAR},
#{depts,mode=OUT,jdbcType=CURSOR,javaType=java.sql.ResultSet,resultMap=getDept})
]]>
</select>
Map<String, Object> param = new HashMap<String, Object>();
param.put("dname", "A");
procedureDao.callProcedure1(param);
List<Dept> depts = (ArrayList<Dept>)param.get("depts");
System.err.println(depts.size());
### Error querying database. Cause: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 2