User Tools

Site Tools


kurs:insert_salary
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
kurs/insert_salary.txt · Last modified: 2014/09/10 21:22 (external edit)