View difference between Paste ID: hwi4GX9C and A9fDm9Ap
SHOW: | | - or go back to the newest paste.
1
DECLARE 
2-
TYPE t_country_names IS TABLE OF wf_countries.country_name%TYPE 
2+
  TYPE t_country_names IS TABLE OF 
3-
INDEX BY BINARY_INTEGER; 
3+
                 wf_countries.country_name%TYPE 
4-
v_country_names      t_country_names; 
4+
                 INDEX BY BINARY_INTEGER; 
5-
CURSOR country_curs IS 
5+
  v_country_names      t_country_names; 
6-
SELECT country_id, country_name 
6+
  CURSOR country_curs IS 
7-
FROM wf_countries 
7+
    SELECT country_id, country_name 
8-
WHERE region_id = 5 
8+
      FROM wf_countries 
9-
ORDER BY country_id; 
9+
      WHERE region_id = 5 
10-
v_country_rec country_curs%ROWTYPE; 
10+
      ORDER BY country_id; 
11
  v_country_rec       country_curs%ROWTYPE; 
12-
OPEN country_curs; 
12+
13-
LOOP 
13+
  OPEN country_curs; 
14-
FETCH country_curs INTO v_country_rec; 
14+
  LOOP 
15-
EXIT WHEN country_curs%NOTFOUND; 
15+
    FETCH country_curs INTO v_country_rec; 
16-
v_country_names(v_country_rec.country_id) :=  v_country_rec.country_name; 
16+
    EXIT WHEN country_curs%NOTFOUND; 
17-
END LOOP; 
17+
    v_country_names(v_country_rec.country_id) := 
18-
CLOSE country_curs; 
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;