PROCEDURE PC_BONUS_CURSOR
   IS
    cursor c_max_bonus is
        SELECT sby_emp_bonus.emp_id, sby_emp_bonus.last_name, sby_emp_bonus.salary
            FROM sby_emp_bonus
            ORDER BY sby_emp_bonus.salary DESC;

    type type_bonus is record (
        emp_id varchar2(10),
        last_name varchar2(30),
        salary number(8,2));

    first_bonus_record type_bonus;
    akt_bonus_record type_bonus;

    i_Prozent number(5,2);
    i_Differenz number(10);
BEGIN
    open c_max_bonus;

    fetch c_max_bonus into first_bonus_record;

    dbms_output.put_line(first_bonus_record.last_name||' hat Chefgehalt von '||first_bonus_record.salary);
    for iInd in 1..9 loop
        fetch c_max_bonus into akt_bonus_record;
        i_Prozent := (akt_bonus_record.salary * 100) / first_bonus_record.salary;
        i_Differenz := first_bonus_record.salary - akt_bonus_record.salary;
        dbms_output.put_line(akt_bonus_record.last_name||' hat Differenz '||i_Differenz||' und prozentuallen Anteil von '||i_Prozent||' % ');

        first_bonus_record := akt_bonus_record;
    end loop;

    close c_max_bonus;

END; -- Procedure