This shows you the differences between two versions of the page.
kurs:insert_salary [2014/09/10 21:22] |
kurs:insert_salary [2014/09/10 21:22] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code> | ||
+ | PROCEDURE PC_INSERT_SALARY | ||
+ | IS | ||
+ | type emp_salary is table of | ||
+ | employees%ROWTYPE | ||
+ | index by binary_integer; | ||
+ | first_index number(30); | ||
+ | last_Index number(30); | ||
+ | |||
+ | emp_table emp_salary; | ||
+ | i_Ind number; | ||
+ | BEGIN | ||
+ | select min(employee_id), max(employee_id) | ||
+ | into first_index, last_Index | ||
+ | from employees; | ||
+ | |||
+ | FOR i_Ind IN first_index..last_index | ||
+ | Loop | ||
+ | select * into emp_table(i_ind) from employees where employee_id = i_Ind; | ||
+ | end loop; | ||
+ | | ||
+ | i_Ind := emp_table.first(); | ||
+ | | ||
+ | for i_Ind in emp_table.first..emp_table.last | ||
+ | loop | ||
+ | insert into pc_employee_bonus (employee_id, last_name, salary) | ||
+ | values (emp_table(i_Ind).employee_id, | ||
+ | emp_table(i_Ind).last_name, | ||
+ | emp_table(i_Ind).salary); | ||
+ | end loop; | ||
+ | | ||
+ | END; -- Procedure | ||
+ | </code> |