1.用current of 有标明 来对当前游标行进行操作
declare
type emps_record_type is record
(
id emps.id%type,
name emps.name%type
);
emps_record emps_record_type;
cursor emps_cursor is select id,name from emps for update;
begin
--打开游标
open emps_cursor;
loop
--提取游标
fetch emps_cursor into emps_record;
--判断游标到的行的列值为2001
if emps_record.id = 2001 then
--更新游标当前行的sal属性
update emps set sal = sal + 100 where current of emps_cursor;
end if;
exit when emps_cursor%notfound;
end loop;
close emps_cursor;
--提交数据,如果不提交则可以rollback (回滚)
commit;
end;