员工涨工资问题
2017-10-14 20:36
591 查看
/*案例
为员工涨工资。从最低工资涨起每人涨10%,但工资总额不能超过5万元,
请计算涨工资的人数和涨工资后的工资总额,并输出涨工资人数及工资总额。
*/
/*分析
SQL语句
select empno,sal from emp order by sal;
–>光标–> 循环 –> 退出条件:1.工资总额>5w 2.%notfound
变量:1.初始值 2.如何得到
涨工资的人数:
countEmp number := 0;
涨后的工资总额:
salTotal number;
1. select sum(sal) into salTotal from emp;
2.涨后的工资总额= 涨前的工资总额+ sal* 0.1
*/
为员工涨工资。从最低工资涨起每人涨10%,但工资总额不能超过5万元,
请计算涨工资的人数和涨工资后的工资总额,并输出涨工资人数及工资总额。
*/
/*分析
SQL语句
select empno,sal from emp order by sal;
–>光标–> 循环 –> 退出条件:1.工资总额>5w 2.%notfound
变量:1.初始值 2.如何得到
涨工资的人数:
countEmp number := 0;
涨后的工资总额:
salTotal number;
1. select sum(sal) into salTotal from emp;
2.涨后的工资总额= 涨前的工资总额+ sal* 0.1
*/
set serveroutput on declare --定义光标 cursor cemp is select empno,sal from emp order by sal; pempno emp.empno%type; psal emp.sal%type; --涨工资人数 countEmp number := 0; --涨后的工资总额 salTotal number; begin --得到工资总额的初始值 select sum(sal) into salTotal from emp; --打开光标 open cemp; loop fetch cemp into pempno, psal; exit when cemp%notfound; --涨后的工资总额(使用涨后的工资判断是否大于50000) exit when salTotal + psal*0.1 >50000; salTotal := salTotal + psal*0.1; update emp set sal = sal*1.1 where empno = pempno; countEmp := countEmp + 1; end loop; --关闭光标 close cemp; commit; dbms_output.put_line('涨工资的人数为:'||countEmp||',涨后的工资总额为:'||salTotal); end; /
相关文章推荐
- 员工工资问题(java)
- 财务人员给员工发工资时经常遇到这样一个问题,即根据每个人的工资额(以元作为单位)计算出各种面值的钞票的张数,且要求总张数最少。
- 涉及2张表的员工涨工资问题
- 第四周项目(拓展1)动态员工工资问题
- 财务人员给员工发工资时经常遇到这样一个问题, 即根据每个人的工资额(以元作为单位)计算出各种面值的钞票的张数,且要求总张数最少。 例如,某职工工资为3436元,发放方案为: 100元34张,20元1张
- 第七周项目三—某员工的工资问题
- 百万员工信息随机生成和工资求和问题
- 第7讲项目3-计算一员工的周工资
- 第7周上机实践项目4——求员工的周工资
- HDUOJ---携程员工运动会场地问题
- MapReduce案例学习(8) 列出工资最高的头三名员工姓名及其工资
- ETH遭空头狙击,有人拿着员工的工资抄底
- 工资问题特别要注意的十个方面
- 你好,C++(38)从问题描述中发现对象的属性和行为 6.4 工资程序成长记:类与对象(上)
- 为什么平时工作不出现,一发工资就出现的员工老板不开除?
- 查询出部门名称、部门的员工数、部门的平均工资、部门的最低收入雇员姓名和最高收入雇员的姓名
- 华为员工标准岗位工资明细及分析
- 硅谷女员工公开吐槽工资低被开除 但这只是开始(很现实的情况,但我觉得要归咎于房租太贵,以及自己的职业生涯计划不合理)
- 工资计算问题,类似计算某天是一年中的第几天的问题
- 李新海说:老板喜欢给这样的员工涨工资