Posted By

wh0emPah on 03/31/10


Tagged


Versions (?)

eee


 / Published in: PL/SQL
 

  1. CREATE OR REPLACE PROCEDURE P2_3_TOPMEDEWERKERS
  2. (
  3. P_AANTAL IN NUMBER
  4. ) AS
  5.  
  6. TYPE TYPE_COLL_SALARY
  7. IS TABLE OF S_EMP.SALARY%TYPE
  8. t_saleries TYPE_COLL_SALARY;
  9.  
  10. TYPE TYPE_COLL_EMPIDS
  11. IS TABLE OF S_EMP.ID%TYPE
  12. t_empids TYPE_COLL_EMPIDS;
  13.  
  14. BULK COLLECT INTO t_saleries
  15. FROM S_EMP
  16. ORDER BY SALARY DESC;
  17.  
  18. DBMS_OUTPUT.PUT_LINE ('Emp ID' || CHR(9)|| 'Salary');
  19. DBMS_OUTPUT.PUT_LINE ('---------' || CHR(9)|| '---------');
  20.  
  21. FOR I IN 1..P_AANTAL LOOP
  22. SELECT ID
  23. BULK COLLECT INTO T_EMPIDS
  24. FROM S_EMP
  25. WHERE SALARY = T_SALERIES(I);
  26.  
  27. FOR J IN 1..T_EMPIDS.COUNT() LOOP
  28. DBMS_OUTPUT.PUT_LINE(T_EMPIDS(J) || CHR(9) ||T_SALERIES(I));
  29. END P2_3_TOPMEDEWERKERS;

Report this snippet  

You need to login to post a comment.