declare
begin
for i in (select * from person t where rownum<10) loop
dbms_output.put_line(i.psn_code||‘******‘||i.zh_name);
end loop;
end;
declare
type v_cur is ref cursor;
v_psn v_cur;
v_psn_code number;
begin
open v_psn for select t.psn_code from person t where rownum<10;
loop
fetch v_psn into v_psn_code ;
exit when v_psn%notfound;
dbms_output.put_line(v_psn_code);
end loop;
close v_psn;
end;
oracle 存储过程遍历
原文:https://www.cnblogs.com/hyhfirst12138/p/9445449.html