--游标
select产生结果集,游标就是该结果集上的指针,类似java迭代器Iterator
declare
cursor c is select ...;
xx(变量) c%rowtype;
begin
open c;
fetch c into xx(变量);
close c;
--循环取游标f for循环最简单不容易出错
loop
exit when(c%notfound);
end loop;
--游标属性
isopen 游标是否打开
notfound 最新的一次fetch没有返回
found 最新的一次fetch有返回
rowcount 当前fetch到多少条记录
--带参数的游标
cursor(参数1类型定义,参数2类型定义),相当于加where条件
--用来更新的游标 加for update
where current of c,当前游标指在哪里就更新哪条