sqlstr:='select * from mytab'; open mycursor for sqlstr; loop fetch mycursor into a,b;--b即为第二列数据 exit when mycursor%notfound;--没有记录退出 if b<0 then --... end if; end loop; close mycursor;
QQ群 38692105 诚招中国IT精英 进群需笔试!~~
cursor c is select * from emp; for r in c loop; result:=r.emp_no; end loop;
open mycursor for sqlstr;
loop
fetch mycursor into a,b;--b即为第二列数据
exit when mycursor%notfound;--没有记录退出
if b<0 then
--...
end if;
end loop;
close mycursor;
for r in c loop;
result:=r.emp_no;
end loop;