create or replace procedure p_name as cursor cursor_name is .........; begin open cursor_name; loop fetch.... exit when cursor_name%notfound .......; end loop; close cursor_name; end;或者是用游标变量create or replace procedure p_name(v_c in out sys_refcursor) is begin open v_c for select .......; .................; end;
define cursor然后open cursor然后一般是循环fetch cursor最后close cursor
as
cursor cursor_name is
.........;
begin
open cursor_name;
loop
fetch....
exit
when cursor_name%notfound
.......;
end loop;
close cursor_name;
end;或者是用游标变量create or replace procedure p_name(v_c in out sys_refcursor)
is
begin
open v_c for
select .......;
.................;
end;