declare
temp_emp test_tw%rowtype;
cursor cur2 is select * from test_tw;
begin
if cur2%isopen = false then
open cur2;
end if;
for i in 0..5 loop
fetch cur2 into temp_emp;
exit when cur2%notfound;
dbms_output.put_line('编号:'||temp_emp.id||','||'名字:'||temp_emp.xm);
end loop;
close cur2;
end;