-- 游标
declare
PAR_ID tb_area_code.par_area_id%type;
AREA_NAME tb_area_code.area_name%type;
cursor c_1 is
select t.par_area_id,t.area_name from tb_area_code t;
begin
open c_1;
fetch c_1 into PAR_ID,AREA_NAME;
while c_1%found loop
dbms_output.put_line(PAR_ID||AREA_NAME);
fetch c_1 into PAR_ID,AREA_NAME;
end loop;
close c_1;
end;
-- 记录变量游标
declare
cursor c_2 is
select t.par_area_id,t.area_name from tb_area_code t;
ee c_2%rowtype;
begin
open c_2;
fetch c_2 into ee;
while c_2%found loop
dbms_output.put_line(ee.par_area_id||ee.area_name);
fetch c_2 into ee;
end loop;
close c_2;
end;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12961536/viewspace-769500/
,如需转载,请注明出处,否则将追究法律责任。