Nested Tables v13
A nested table is a type of collection that associates a positive integer with a value. A nested table has the following characteristics:
- A nested table type must be defined after which nested table variables can be declared of that nested table type. Data manipulation occurs using the nested table variable, or simply, “table” for short.
- When a nested table variable is declared, the nested table initially does not exist (it is a null collection). The null table must be initialized with a constructor. You can also initialize the table by using an assignment statement where the right-hand side of the assignment is an initialized table of the same type. Note: Initialization of a nested table is mandatory in Oracle, but optional in SPL.
- The key is a positive integer.
- The constructor establishes the number of elements in the table. The
EXTEND
method adds additional elements to the table. See Collection Methods for information on collection methods. Note: Usage of the constructor to establish the number of elements in the table and usage of theEXTEND
method to add additional elements to the table are mandatory in Oracle, but optional in SPL. - The table can be sparse - there may be gaps in the assignment of values to keys.
- An attempt to reference a table element beyond its initialized or extended size will result in a
SUBSCRIPT_BEYOND_COUNT
exception.
The TYPE IS TABLE
statement is used to define a nested table type within the declaration section of an SPL program.