This shows you the differences between two versions of the page.
— |
kurs:calc_bonus [2014/09/10 21:22] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code> | ||
+ | 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; | ||
+ | </code> |