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