CREATE OR REPLACE PROCEDURE calc_bonus()
IS
var_bonus_rate FLOAT;
var_emp_record emp%ROWTYPE;
var_years_worked int;
CURSOR cur_emp IS
SELECT *
FROM emp
WHERE emp <> 'Pres';
BEGIN
OPEN emp_cur;
LOOP
FETCH cur_emp INTO var_emp_record;
EXIT WHEN cur_emp%NOTFOUND;
var_bonus_rate := 0.1;
IF (var_years_worked > 10) THEN
var_bonus_rate := var_bonus_rate + 0.1;
ELSIF (var_years_worked > 5) THEN
var_bonus_rate := var_bonus_rate + 0.05;
END IF;
IF var_emp_record.job = 'Designer' THEN
var_bonus_rate := var_bonus_rate + 0.15;
ELSIF var_emp_record.job = 'Manager' THEN
var_bonus_rate := var_bonus_rate + 0.1;
END IF;
UPDATE emp e2
SET e2.bonus = e2.salary * var_bonus_rate;
END LOOP;
CLOSE emp_cur;
END;
/
我收到的错误
1/22 PLS-00103: Encountered the symbol ")" when expecting one of the
following:
<an identifier> <a double-quoted delimited-identifier>
current delete exists prior