User Tools

Site Tools


kurs:p_bonus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

kurs:p_bonus [2014/09/10 21:22]
kurs:p_bonus [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​
 +PROCEDURE P_BONUS
 +   
 +   IS
 +cursor c_bonus is
 +SELECT is_emp_bonus.last_name,​ is_emp_bonus.salary,​
 +       ​is_emp_bonus.bonus
 +  FROM is_emp_bonus
 +  order by is_emp_bonus.salary DESC
 +  for update of bonus;
  
 +  type bon_rec_record_type is record
 +  (last_name ​ is_emp_bonus.last_name%TYPE,​
 +   ​salary ​    ​is_emp_bonus.salary%TYPE,​
 +   ​bonus ​     is_emp_bonus.bonus%TYPE);​
 +  ​
 +  bon_rec ​  ​bon_rec_record_type;​
 +  v_bonus ​  ​number(30,​2);​
 +  ​
 +BEGIN
 +    for bon_rec in c_bonus
 +    loop
 +    v_bonus := 0.2;
 +    if bon_rec.salary>​5000 then
 +      v_bonus := 0.05;
 +    end if;
 +    update is_emp_bonus
 +      set bonus = bon_rec.salary*v_bonus
 +      where current of c_bonus;
 +    end loop;
 +
 +END; -- Procedure
 +</​code>​
kurs/p_bonus.txt ยท Last modified: 2014/09/10 21:22 (external edit)