根據(jù)老師的結(jié)果為什么要手動執(zhí)行幾次循環(huán)?有沒有什么辦法讓程序自動重復(fù)執(zhí)行
declare
? cursor cemp is
? ? select empno, sal from emp;
? cempno? ?emp.empno%type;
? csal? ? ?emp.sal%type;
? empcount number := 0;
? totalsal number;
begin
? open cemp;
? select sum(sal) into totalsal from emp;
? loop
? ? fetch cemp
? ? ? into cempno, csal;
? ? --判斷漲后工資是否超過5萬
? ? exit when totalsal + csal * 0.1> 50000;
? ? update emp set sal = sal + sal * 0.1 where empno = cempno;
? ? exit when cemp%notfound;
? ? empcount := empcount + 1;
? ? --漲后工資總額
? ? totalsal := totalsal + csal * 0.1;
? end loop;
? close cemp;
? dbms_output.put_line('漲工資人數(shù): ' || empcount || '? 總工資: ' || totalsal);
end;