存储过程:
create or replace procedure P_search(weight_value in integer, p_cursor out types.searchNature_CURSOR) as
begin
open p_cursor for
select globalId
from (select sum(WEIGHT) as w, globalId
from EMPI_TEMP
group by globalId
order by sum(WEIGHT) desc)
where w > weight_value;
end P_search;
sqlMap.xml:
<parameterMap id="test_map" class="java.util.HashMap">
<parameter property="weight_value" jdbcType="INTEGER"
javaType="java.lang.Integer" mode="IN" />
<parameter property="p_cursor" jdbcType="ORACLECURSOR"
javaType="java.sql.ResultSet" mode="OUT"/>
</parameterMap>
<procedure id="query_search" parameterMap="test_map" resultClass="java.lang.String">
{call p_search(?,?)}
</procedure>
java:
SqlMapClient client = IBatisConfig.getSqlMapper();
Map<String,Object> map = new HashMap<String,Object>();
map.put("weight_value", 30);
try {
List<String> list = client.queryForList("query_search",map);
System.out.println(list.size());
}
catch (SQLException e) {
}
使用 ibatis 2.1.6 版本执行有问题。搞了半天。发现时这个版本对存储过程支持有问题。
换成 2.3.4 问题解决。
分享到:
相关推荐
ibatis调存储过程返回游标,资料整理
ibatis调用存储过程使用示例,处理带参数及无参数类型的存储过程,是一个不错的例子。
用ibatis调用存储过程的介绍,使用java语言进行开发
iBatis调用存储过程
ibatis调用oracle存储过程分页
ibatis调用存储过程.txt [removed] var share_info = {}; [removed]
IBATIS调用存储过程
NULL 博文链接:https://jun1986.iteye.com/blog/1290064
Ibatis中调用其它的SQL语句很容易,那么如何在Ibatis中调用存储过程呢?
ibatis调用oracle存储过程
Ibatis调用Oracle存储过程,返回自定义的类型。
ibatis调用oracle的函数,存储过程的方法,从网上收集的,还没有整理。
NULL 博文链接:https://fengtiejun.iteye.com/blog/1603851
使用J2EE+Spring+Ibatis+JDBC 调用存储过程,并返回结果集的配置详细。 供学习参考。
NULL 博文链接:https://pzh244658240.iteye.com/blog/1423681
ibatis与存储过程(带输出参数的应用)
ibatis增删查改,存储过程调用。包含表结构。
基于SQLserver 数据库的IBatis中存储过程应用实例
该问题对初学者很有提示性帮助,里面主要是个人对ibatis的##的认识