10.7. Data Abstraction

You can simplify complex application logic by building abstract structures on top of the existing language structures. The following package implements a STACK built using a PL/SQL index-by table. This is a last-in-first-out (LIFO) stack of student names. This demonstrates the ability to bind data and operations together and restrict the interface to the definitions in the package specification.

The user of this package must conform to the push/pop operations in the specification. Although the package body implements this structure with an index-by table, the implementation could be a database table, a set of tables, or tables in another database—this uses a PL/SQL table.

The stack package has the following operations and ...

Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.