Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DECLARE
  2. TYPE t_country_names IS TABLE OF
  3. wf_countries.country_name%TYPE
  4. INDEX BY BINARY_INTEGER;
  5. v_country_names t_country_names;
  6. CURSOR country_curs IS
  7. SELECT country_id, country_name
  8. FROM wf_countries
  9. WHERE region_id = 5
  10. ORDER BY country_id;
  11. v_country_rec country_curs%ROWTYPE;
  12. BEGIN
  13. OPEN country_curs;
  14. LOOP
  15. FETCH country_curs INTO v_country_rec;
  16. EXIT WHEN country_curs%NOTFOUND;
  17. v_country_names(v_country_rec.country_id) :=
  18. v_country_rec.country_name;
  19. END LOOP;
  20. CLOSE country_curs;
  21. FOR i IN v_country_names.FIRST .. v_country_names.LAST
  22. LOOP
  23. IF v_country_names.EXISTS(i) THEN
  24. DBMS_OUTPUT.PUT_LINE(i || ' ' || v_country_names(i));
  25. END IF;
  26. END LOOP;
  27. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement