FUNCTION CALC_BONUS
( salary IN number,
hiredate IN date )
-- berechnet einen 20%igen Bonus
/* Das ist ein mehrzeiliger
Kommentar
*/
RETURN number IS
bonus EMPLOYEES.salary%Type;
bonus_percentage number(9,2);
BEGIN
select GET_NUMPARAM('bonus_percentage') into bonus_percentage from dual;
bonus := salary*bonus_percentage/100;
-- if hiredate < sysdate - to_yminterval('10-0') oder:
if (extract(year from sysdate) - extract(year from hiredate)) >= 10
then bonus := bonus + 100;
end if;
RETURN bonus;
END;