一、PL/SQL调试存储过程
1.1、编写 get_recomend_news.sql
CREATE OR REPLACE PROCEDURE get_recomend_news(userName in varchar2,resultList out sys_refcursor)
IS
--定义变量
CURSOR my_cursor is select a.news_type from news_scan_info a where a.user_name=userName order by a.click_count desc;
firstType varchar2(100);
secondType varchar2(100);
thirdType varchar2(100);
i number;
BEGIN
i := 0;
FOR c IN my_cursor LOOP
i := i+1;
if i=1 then
firstType := c.news_type;
end if;
if i=2 then
secondType := c.news_type;
end if;
if i=3 then
thirdType := c.news_type;
end if;
END LOOP;
OPEN resultList FOR
select * from (select * from news_info b where b.news_type=firstType order by id desc)where rownum<=5
union all
select * from (select * from news_info b where b.news_type=secondType order by id desc)where rownum<=3

本文介绍了如何在Mybatis中调用返回结果集的存储过程,包括在PL/SQL中编写和调试存储过程,以及在Mybatis配置文件和代码中如何进行调用。在调试过程中遇到了无法进入断点的问题,解决方法是为存储过程添加调试信息。
291

被折叠的 条评论
为什么被折叠?



