createorreplaceprocedurexsxxgl_test_3is
begin
for test_rec in (select * fromxsxxgl_xsjbxx_testwhererownum < 5)
loop
dbms_output.put_line(test_rec.xh);
endloop;
endxsxxgl_test_3;
----------------上面可改写成下面形式(推荐)-----------------
create or replace procedure xsxxgl_test_3 is
cursor test_cur is select * from xsxxgl_xsjbxx_test where rownum < 5;
begin
for test_rec in test_cur
loop
dbms_output.put_line(test_rec.xh);
end loop;
end xsxxgl_test_3;
游标型的需要提供一个明确的游标或者select语句,而不是数值型的for循环使用的整数的上下界