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;