0
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
4

1 に答える 1

0

CREATE OR REPLACE PROCEDURE calc_bonus()- これがエラーの原因です。括弧を削除するか、いくつかの引数を追加してください。あなたの選択肢は

 1. CREATE OR REPLACE PROCEDURE calc_bonus is
 2. CREATE OR REPLACE PROCEDURE calc_bonus(p_Param1 datatype, ... 
                                         , p_paramN datatype) is
于 2012-09-13T06:20:54.840 に答える