oracle但参数的游标

declare cursor mysor(proname varchar2) is
select * from sys_pro_monitor where pro_name=proname;
c_row mysor%rowtype;
begin
 open mysor('PRO_RPT_KPI') ;
 loop
   fetch mysor into c_row;
   exit when mysor%notfound;
   dbms_output.put_line(c_row.id);
 end loop;
end;

 

第二种写法:

declare cursor mysor(proname varchar2) is
select * from sys_pro_monitor where pro_name=proname;
c_row mysor%rowtype;
begin
 for c_row in mysor('PRO_RPT_KPI') loop
 dbms_output.put_line(c_row.id);
 end loop;
end;

你可能感兴趣的:(oracle)