一、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=