Posted By

wh0emPah on 04/01/10


Tagged


Versions (?)

azeae


 / Published in: PL/SQL
 

  1. CREATE OR REPLACE PROCEDURE P3_2_TOP_DOGS2
  2. (
  3. P_AANTAL IN NUMBER
  4. ) AS
  5.  
  6. CURSOR C_SALARIES IS
  7. FROM S_EMP
  8. ORDER BY SALARY DESC;
  9.  
  10. CURSOR C_EMPLOYEES
  11. (P_SALARY IN S_EMP.SALARY%TYPE) IS
  12. SELECT ID
  13. FROM S_EMP
  14. WHERE SALARY=P_SALARY;
  15.  
  16.  
  17. DBMS_OUTPUT.PUT_LINE ('Emp ID' || CHR(9)|| 'Salary');
  18. DBMS_OUTPUT.PUT_LINE ('---------' || CHR(9)|| '---------');
  19.  
  20. FOR R_SALARIES IN C_SALARIES LOOP
  21. EXIT WHEN C_SALARIES%ROWCOUNT > P_AANTAL;
  22. FOR R_EMPLOYEES IN C_EMPLOYEES(R_SALARIES.SALARY) LOOP
  23. DBMS_OUTPUT.PUT_LINE (R_EMPLOYEES.ID ||CHR(9) || R_SALARIES.SALARY);
  24.  
  25. END P3_2_TOP_DOGS2;

Report this snippet  

You need to login to post a comment.