declare
varno varchar2(20);
varprice varchar2(20);
CURSOR mycur(vartype number) is select pk,opid from tb_gos_sale_salestockoutsum where pk = vartype;
begin
if mycur%isopen = false then
open mycur(1166);
end if;
fetch mycur into varno,varprice;
while mycur%found
loop
dbms_output.put_line(varno||','||varprice);
if mycur%rowcount=2 then
exit;
end if;
fetch mycur into varno,varprice;
end loop;
close mycur;
end;