FUNCTION CALC_BONUS
( salary IN number,
hire_date IN date)
RETURN number IS
-- here the bonus var is defined
bonus employees.salary%TYPE;
bonus_percentage employees.salary%TYPE;
BEGIN
/* this function calclates the bonus
based on the input */
bonus_percentage := get_p_number('bonus_percentage');
bonus := salary * bonus_percentage;
if hire_date < (sysdate - to_yminterval('10-0')) then
bonus := bonus + 100000;
end if;
RETURN bonus;
END;