2 power520243 power520243 于 2017.09.10 23:18 提问

请问有大神知道JDBC调用sql server 中带游标返回参数的存储过程的方法吗

create procedure RankBoard
@RankType int,
@cur_rank cursor varying output
as
begin
if(@RankType=0)
set @cur_rank = cursor forward_only static for
select articleID,articleTitle,click
from BlogArticles
order by click desc
else if(@RankType=1)
set @cur_rank = cursor forward_only static for
select userID,uname,numOfVisit
from BlogUser
order by numOfVisit desc
else if(@RankType=2)
set @cur_rank = cursor forward_only static for
select BlogComment.articleID,articleTitle,count(BlogComment.articleID)
from BlogComment,BlogArticles
where BlogComment.articleID=BlogArticles.articleID
group by BlogComment.articleID,articleTitle
order by count(BlogComment.articleID)
open cur_rank
end
存储过程如上所示,求JDBC调用返回的游标结果集的方式,万分感谢❤

1个回答

qq_37170555
qq_37170555   2017.09.11 10:30

看你上面这样写应该是需要在别的存储过程中调用这个游标是吧,你可以参考一下这篇文章http://greatwqs.iteye.com/blog/1446787

Csdn user default icon
上传中...
上传图片
插入图片