Oracle PL/SQL Tutorial/Collections/Varray of Varchar2

Материал из SQL эксперт
Перейти к: навигация, поиск

Nested Table OF varchar2

SQL> DECLARE
  2    TYPE courseList IS TABLE OF varchar2(25);
  3    cl courseList;
  4  BEGIN
  5    cl := null;
  6    cl := courseList();
  7    cl := courseList("CS 111","CS 436");
  8    cl := courseList("CS 111",NULL,"CS 436");
  9    dbms_output.put_line(cl.COUNT);
 10  END;
 11  /
PL/SQL procedure successfully completed.
SQL>


VARRAY of varchar2

SQL> DECLARE
  2    TYPE courseList IS VARRAY(3) OF varchar2(25);
  3    cl courseList;
  4  BEGIN
  5    cl := null;
  6    cl := courseList();
  7    cl := courseList("CS 111","CS 436");
  8    cl := courseList("CS 111",NULL,"CS 436");
  9  END;
 10  /
PL/SQL procedure successfully completed.
SQL>