8.1. Using PLVtab-Based PL/SQL Table Types
When you use PL/SQL tables, you normally perform a number of common actions, including defining the table type, declaring the table, filling up the rows, referencing the rows, and emptying the table when done. When using a PLVtab-based table, you do not have to declare the table type. Instead you simply reference the package-based type in your declaration. PLVtab predefines the following PL/SQL table TYPEs, shown in Table 8.1:
| Type | Description |
|---|---|
boolean_table | PL/SQL table of Booleans |
date_table | PL/SQL table of dates |
integer_table | PL/SQL table of integers |
number_table | PL/SQL table of numbers |
vc30_table | PL/SQL table of VARCHAR2(30) strings |
vc60_table | PL/SQL table of VARCHAR2(60) strings |
vc80_table | PL/SQL table of VARCHAR2(80) strings |
vc2000_table | PL/SQL table of VARCHAR2(2000) strings |
ident_table | PL/SQL table of VARCHAR2(100) strings; matches PLV.plsql_identifier declaration. |
vcmax_table | PL/SQL table of VARCHAR2(32767) strings |
Let's compare the "native" and PL/Vision approaches to defining PL/SQL tables. In the following anonymous block, I define a PL/SQL table of Booleans without the assistance of PLVtab.
DECLARE
TYPE bool_tabtype IS TABLE OF BOOLEAN
INDEX BY BINARY_INTEGER;
yesno_tab bool_tabtype;
BEGIN
With the PLVtab package in place, all I have to is the following:
DECLARE yesno_tab PLVtab.boolean_table; BEGIN
Once you have declared a table using PLVtab, you manipulate that table as you would ...