天天看點

oracle遊标帶參,oracle帶參數的遊标-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.2cto.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;