SQL>
SQL>
SQL> CREATE TABLE birthday (
2 party_date DATE,
3 fav_present VARCHAR2(100)
4 );
Table created.
SQL>
SQL> INSERT INTO birthday VALUES ('01-OCT-92', 'A');
1 row created.
SQL> INSERT INTO birthday VALUES ('01-OCT-98', 'B');
1 row created.
SQL>
SQL> DECLARE
2 TYPE name_tt IS TABLE OF birthday.fav_present%TYPE INDEX BY BINARY_INTEGER;
3 the_best name_tt;
4 indx PLS_INTEGER;
5 BEGIN
6 indx := the_best.FIRST;
7 LOOP
8 EXIT WHEN indx IS NULL;
9 DBMS_OUTPUT.PUT_LINE (the_best(indx));
10 indx := the_best.NEXT (indx);
11 END LOOP;
12 END;
13 /
PL/SQL procedure successfully completed.
SQL>
SQL> drop table birthday;
Table dropped.
SQL>
SQL>
|