为什么显示代码错误呢?
set serveroutput on
declare
cursor guangbiao2 is SELECT empno, sal FROM emp order by sal;
pempno emp.empno% TYPE;
psal emp.sal% TYPE;
pname NUMBER:=0;
tolsal NUMBER;
BEGIN
SELECT sum(sal) into tolsal from emp;
open guangbiao2;
loop
exit when tolsal>50000;
fetch guangbiao2 into pempno,psal;
exit when (tolsal + psal*0.1) > 50000;
update emp set sal=sal*1.1 when empno=pempno;
pname:=pname+1;
tolsal:=tolsal+psal*0.1;
end loop;
close guangbiao2;
commit;
dbms_output.put_line(pename||psal);
end;
/