Ibatis调用存储过程in输入out游标
我Ibatis版本为2.3.4,数据库为Oracle 10gspring中调用ibatis的时候总是返回:
Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ibatis/Empl/Emp.xml.
--- The error occurred while applying a parameter map.
--- Check the Emp.pro_cursor_map_page.
--- Check the statement (update procedure failed).
--- Cause: java.sql.SQLException: ORA-06550: 第 1 行, 第 7 列:
PLS-00306: 调用 'SP_PROCE_EMP_PAGE' 时参数个数或类型错误
ORA-06550: 第 1 行, 第 7 列:
PLS-00306: 调用 'SP_PROCE_EMP_PAGE' 时参数个数或类型错误
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored
SQL code:
create or replace procedure sp_proce_emp_page(pageCounts in integer,
pageNums in integer,
re_cur out retu_cur.test_cursor)
as
/*re_cur retu_cur.test_cursor;
v_empno number(4);
v_empname varchar2(10);*/
begin
open re_cur for
select tt.empno,tt.ename from (
select rownum r,t.empno,t.ename from emp t where rownum<pageNums*pageCounts+1) tt
where tt.r>(pageNums-1)*pageCounts;
/* loop
fetch re_cur into v_empno,v_empname;
exit when re_cur%notfound;
dbms_output.put_line(v_empno||';'||v_empname);
end loop;*/
end sp_proce_emp_page;
XML:code
<resultMap id="reMaps" class="cn.com.von.entity.Emp">
<result property="empno" column="EMPNO"/>
<result property="ename" column="ENAME"/>
</resultMap>
<parameterMap class="java.util.Map" id="pro_cursor_map_page">
<parameter property="re_cur" javaType="java.sql.ResultSet"
jdbcType="ORACLECURSOR" mode="OUT" />
<parameter property="pageCounts" javaType="java.lang.Integer"
jdbcType="INTEGER" mode="IN"/>
<parameter property="pageNums" javaType="java.lang.Integer"
jdbcType="INTEGER" mode="IN"/>
</parameterMap>
<procedure id="getEmp_page" parameterMap="pro_cursor_map_page" resultMap="reMaps" >
{call sp_proce_emp_page(?,?,?)}
</procedure>
java code:
//调用存储过程
public List<Emp> retur_page(Map<String,Object> map){//.queryForList("Emp.getEmp_page");
return (List<Emp>)getSqlMapClientTemplate().queryForList("Emp.getEmp_page",map);
}
//入参设定
maps.put("pageCounts", 5);
maps.put("pageNums", 2);
List<Emp> e = sqlMapClient.retur_page(maps);//sqlMapClient.returE();
--------------------编程问答-------------------- 参数个数或类型错误!自己检查!
补充:Java , Java EE