create or replace procedure proc_name as cursor cursor1 is select * from tb_name where 你说的字段=1 and ...; cursor cursor2 is select * from tb_name where 你说的字段=2 and ...; begin for c_cursor1 in cursor1 loop ...; end loop; for c_cursor2 in cursor2 loop ...; end loop; exception when others then dbms_output.put_line('error;'||sqlerrm); end proc_name;
as
cursor cursor1
is
select * from tb_name where 你说的字段=1 and ...;
cursor cursor2
is
select * from tb_name where 你说的字段=2 and ...;
begin
for c_cursor1 in cursor1 loop
...;
end loop;
for c_cursor2 in cursor2 loop
...;
end loop;
exception
when others then
dbms_output.put_line('error;'||sqlerrm);
end proc_name;