Oracle游标举例

declare 
cursor cur_1 is select distinct sid from info order by sid;
cursor cur_2(v_sid number) is select sid,hobby from info where sid=v_sid and rownum<=4 order by sid;
begin
for r_cur1 in cur_1
loop
for r_cur2 in cur_2(r_cur1.sid)
loop
dbms_output.put_line (r_cur2.sid||','||r_cur2.hobby);
end loop;
end loop;
end;
posted @ 2013-08-27 11:25  prison  阅读(243)  评论(0编辑  收藏  举报