PL/SQL User's Guide and Reference

Contents Index Home Previous Next

PL/SQL Table Improvements

Now, you can declare PL/SQL tables of records as well as PL/SQL tables of scalars. That means a PL/SQL table can store rows (not just a column) of Oracle data. PL/SQL tables of records make it easy to move collections of data into and out of database tables or between client-side applications and stored subprograms. You can even use PL/SQL tables of records to simulate local database tables.

Also, several new attributes give you previously unavailable information about a PL/SQL table. Attributes are characteristics of an object. Every PL/SQL table has the attributes EXISTS, COUNT, FIRST, LAST, PRIOR, NEXT, and DELETE. They make PL/SQL tables easier to use and your applications easier to maintain.

For example, COUNT returns the number of elements that a PL/SQL table contains. COUNT is useful because the size of a PL/SQL table is unconstrained. Suppose you fetch a column of Oracle data into a PL/SQL table. How many elements does the PL/SQL table contain? COUNT gives you the answer.

To apply the attributes to a PL/SQL table, you use dot notation, as the following example shows:

IF ename_tab.COUNT = 50 THEN ...

For more information, see "PL/SQL Tables" [*].


Contents Index Home Previous Next