Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. CREATE OR REPLACE PROCEDURE Ranking
  2. (n IN number)
  3. RETURN number
  4. IS
  5. nrows number;
  6. CURSOR cursor1
  7. IS
  8. SELECT wartosc
  9. FROM tab3
  10. ORDER BY wartosc DESC;
  11. BEGIN
  12. dbms_output.put_line('Ranking:');
  13. OPEN cursor1;
  14. LOOP
  15. FETCH cursor1 INTO nrows;
  16. EXIT WHEN cursor1%NOTFOUND OR cursor1%NOTFOUND IS NULL;
  17. dbms_output.put_line(nrows);
  18. END LOOP;
  19. CLOSE cursor1;
  20. EXCEPTION
  21. WHEN OTHERS THEN
  22. raise_application_error(-20001,'An error was encountered -
  23. '||SQLCODE||' -ERROR- '||SQLERRM);
  24. END;
  25. /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement