1
即時得到我下面的函數內的幾個錯誤:獲取PLS-00103錯誤在Oracle中創建一個函數時
CREATE OR REPLACE FUNCTION department_salary
(emp_dept VARCHAR2, salary NUMBER)
RETURN NUMBER AS
dept_sal NUMBER := salary;
BEGIN
IF emp_dept = 'MIS' THEN dept_sal := (dept_sal * .10) + dept_sal;
ELSEIF emp_dept = 'SALES' THEN dept_sal := (dept_sal * .15) + dept_sal;
ELSEIF emp_dept = 'HR' THEN dept_sal := (dept_sal * .20) + dept_sal;
ELSE dept_sal := -1;
END IF;
RETURN dept_sal;
END;
/
我得到的錯誤有以下幾種:
LINE/COL ERROR
-------- ----------------------------------------------------------------
7/10 PLS-00103: Encountered the symbol "EMP_DEPT" when expecting one
of the following:
:= . (@ % ;
8/10 PLS-00103: Encountered the symbol "EMP_DEPT" when expecting one
of the following:
:= . (@ % ;
14/4 PLS-00103: Encountered the symbol ";" when expecting one of the
following:
if
它可能會顯得更加清晰代碼這就像'return case'emp_dept when'mis'then'foo when'sales'then bar'等 –