我正在尝试创建包和程序,我找到所有以MA或SA开头的工作,如果他们的工资低于平均水平薪水,然后增加他们的工资33%。如果员工平均工资低于平均水平,可以获得员工平均工资
我找不到问题并使其工作。
下面是代码,无法得到它的工作:
create or replace package body name2 as
procedure one(
alga emp.sal%type,
new_sal emp.sal%type)
cursor kursors1 is
select ename, sal from emp where job LIKE 'MA%' OR e.job LIKE 'SA%' for update sal;
begin
select round(avg(sal),2) videja_alga into alga from emp
for darb in kursors1
loop
if darb.sal < alga then
new_sal:=darb.sal+(darb.sal*0.33);
dbms_output.put_line('New sal: ' || darb.sal);
update emp set sal = new_sal where current of kursors1;
end if;
end loop;
end;
end name2;
/
你真的想做pl/sql吗?不是Sql语句?更新emp设置sal = sal * 0.33其中(作业像'MA%'或e.job LIKE'SA%')和sal <(从emp选择avg(薪水)) –