temp_test表只有一个name列,为varchar2(30)类型
设计下面的匿名块为name列各行的值加一个前缀 'D_',成功运行后,结果是:各偶数行的值添加成功,各奇数行的值却保持原样

,请教各位问题出自哪里?
declare
v_name varchar(30);
cursor name_cur is select name from temp_test for update of name;
begin
for y in name_cur
loop
fetch name_cur into v_name;
exit when name_cur%notfound;
v_name:='D_'||v_name;
-- dbms_output.put_line('v_name after change: '||v_name);
update temp_test set name = v_name where current of name_cur;
end loop;
commit;
exception
when others
then
dbms_output.put_line(sqlerrm);
rollback;
end;
/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/310745/viewspace-6307/
,如需转载,请注明出处,否则将追究法律责任。