继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

啦啦啦啦员工工资合计代码

wuli少帥
关注TA
已关注
手记 1
粉丝 0
获赞 2
set serveroutput on; declare cursor cdept is select deptno from dept; pdeptno dept.deptno%type; cursor cemp(dno number) is select sal from emp where deptno=dno; psal emp.sal%type; count1 number; count2 number ; count3 number; totalsal number; begin open cdept; loop fetch cdept into pdeptno; exit when cdept%notfound; count1:=0;count2:=0;count3:=0;totalsal:=0; open cemp(pdeptno); loop fetch cemp into psal; exit when cemp%notfound; if psal < 3000 then count1:=count1+1; elsif psal >= 3000 and psal <= 6000 then count2:=count2+1; elsif psal > 6000 then count3:=count3+1; end if; totalsal:=totalsal+psal; end loop; insert into test values(pdeptno,count1,count2,count3,totalsal); close cemp; end loop; close cdept; dbms_output.put_line('完成'); commit; end;
打开App,阅读手记
2人推荐
发表评论
随时随地看视频慕课网APP