小弟最近几天在学存储过程 碰到问题一堆
先感谢下csdn的大侠们。虽然我的问题比较cai,但是大侠们仍谆谆教导 ,感动ing 下面这个简单的加薪代码,给工资等于2459的员工统一加上1000元 不知道错在哪里?create or replace procedure lee_update_sala
as
cursor c_row
is
select * from lee_emp_0714 for update of sala;beginfor v_row in c_row loopif v_row.sala=2459 then sala:=sala+1000;
end loop;
end;运行时 提示
(S224) Expecting: statement_terminator BEGIN CASE DECLARE END IDENTIFIER IF LOOP
先感谢下csdn的大侠们。虽然我的问题比较cai,但是大侠们仍谆谆教导 ,感动ing 下面这个简单的加薪代码,给工资等于2459的员工统一加上1000元 不知道错在哪里?create or replace procedure lee_update_sala
as
cursor c_row
is
select * from lee_emp_0714 for update of sala;beginfor v_row in c_row loopif v_row.sala=2459 then sala:=sala+1000;
end loop;
end;运行时 提示
(S224) Expecting: statement_terminator BEGIN CASE DECLARE END IDENTIFIER IF LOOP
改成update lee_emp_0714 set sala=sala+1000 where sala=2459;
直接这样写就行了啊
update lee_emp_0714 set sala=sala+1000 where sala=2459;
错误很多。
修改如下:
create or replace procedure lee_update_sala
as
cursor c_row
is
select * from lee_emp_0714 where sala=2459 for update of sala;
begin
for v_row in c_row loop
update lee_emp_0714 set sala=sala+1000 where current of c_row;
end loop;
commit;
end;
/