Oracle PL/SQL - Nested Tables of Nested Tables and Varrays of Integers

Introduction

In the following code, table_type_1 is a nested table of nested tables of strings, and table_type_2 is a nested table of varrays of integers.

Demo

SQL>
SQL> DECLARE--  w  w w .j  a v a 2 s .c om
  2    TYPE tb1 IS TABLE OF VARCHAR2(20);  -- nested table of strings
  3    vtb1 tb1 := tb1('one', 'three');
  4
  5    TYPE table_type_1 IS TABLE OF tb1;
  6    vntb1 table_type_1 := table_type_1(vtb1);
  7
  8    TYPE tv1 IS VARRAY(10) OF INTEGER;  -- varray of integers
  9    TYPE table_type_2 IS TABLE OF tv1;        
 10    vntb2 table_type_2 := table_type_2(tv1(3,5), tv1(5,7,3));
 11
 12  BEGIN
 13    vntb1.EXTEND;
 14    vntb1(2) := vntb1(1);
 15    vntb1.DELETE(1);    
 16    vntb1(2).DELETE(1);  
 17  END;
 18  /

PL/SQL procedure successfully completed.

SQL>

Related Topic