oracle带参数的游标
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;
第二种写法: www.zzzyk.com
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;