これには と の横にエラーがありVARCHAR2
ます(4)
:
CREATE OR REPLACE FUNCTION Employee_exists
(p_employee_id IN NUMBER)
RETURN VARCHAR2(4);
AS
BEGIN
SELECT employee_id
FROM employees
WHERE employee_id = p_employee_id;
RETURN 'true';
END Employee_exists;
ここでは、宣言の横にエラーがあると書かれていますv_years_service
:
CREATE OR REPLACE FUNCTION Calculate_Bonus(p_salary IN NUMBER, p_startdate IN DATE)
RETURN NUMBER -- here it errors
AS
v_years_service NUMBER;
BEGIN
v_years_service := TRUNC(Months_Between(SYSDATE, v_startdate) /12);
IF (v_years_service <2) THEN
p_bonus := v_salary * 0.02;
ELSE
IF (v_year_service <2) THEN
p_bonus := v_salary * 0.04;
ELSE
p_bonus := v_salary * 0.05;
RETURN p_bonus;
END IF;
END Calculate_Bonus;
/
show err