User Tools

Site Tools


kurs:p_fill_emp
PROCEDURE P_FILL_EMP_BONUS
   IS
   type emp_rec_table is table of
     employees%ROWTYPE
     index by binary_integer;
     
   first_index number(30);
   last_index  number(30);
   emp_rec emp_rec_table;
BEGIN
   select
     min(employee_id),
     max(employee_id)
   into
     first_index,
     last_index
   from employees;

   for i in first_index..last_index loop
     select * into emp_rec(i)
     from
       employees
     where
       employee_id = i;
   end loop;
   
   for i in emp_rec.first..emp_rec.last loop
     insert into emp_bonus
       (emp_id,
        last_name,
        salary)
     values
       (emp_rec(i).employee_id,
        emp_rec(i).last_name,
        emp_rec(i).salary);
   end loop;
END; -- Procedure
kurs/p_fill_emp.txt · Last modified: 2014/09/10 21:22 (external edit)