Skip to Main Content
Advanced Oracle PL/SQL Programming with Packages
book

Advanced Oracle PL/SQL Programming with Packages

by Steven Feuerstein
October 1996
Intermediate to advanced content levelIntermediate to advanced
687 pages
16h 41m
English
O'Reilly Media, Inc.
Content preview from Advanced Oracle PL/SQL Programming with Packages

8.7. Implementing PLVtab.display

I faced several challenges when building the display procedures:

  • I had to create a separate procedure for each of the different table types, but I did not want to actually have separate display engines for each table type; the code would be very cumbersome and lengthy. Yet consolidating this code would also be difficult since each display procedure drew its information from a different PL/SQL table.

  • With the implementation of PL/SQL tables prior to Release 2.3 of PL/SQL, it is impossible to obtain information about the state of a PL/SQL table from the runtime engine. Instead, you must keep track of the rows that have been used or be ready to handle the NO_DATA_FOUND exception.

I took care of the code redundancy problem by creating a single internal display procedure (idisplay) that is called by each of the public display procedures. Here is an example of the full body of the display procedure for date tables:

PROCEDURE display 
      (tab_in IN date_table, 
       end_in IN INTEGER,
       hdr_in IN VARCHAR2 := NULL,
       start_in IN INTEGER := 1,
       failure_threshold_in IN INTEGER := 0,
       increment_in IN INTEGER := +1)
   IS
   BEGIN
      idate := tab_in;
      idisplay
        (c_date, end_in, hdr_in, start_in, 
         failure_threshold_in, increment_in);
      idate := empty_date;
   END;

What is going on here? First, I copy the incoming table into a private PL/SQL table (idate). Then I display the contents of the idate table and not the user's table. Finally, I empty the internal PL/SQL table to minimize memory ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle Database 12c PL/SQL Programming

Oracle Database 12c PL/SQL Programming

Michael McLaughlin
Oracle PL/SQL for DBAs

Oracle PL/SQL for DBAs

Arup Nanda, Steven Feuerstein
Expert Oracle PL/SQL

Expert Oracle PL/SQL

Ron Hardman, Michael McLaughlin

Publisher Resources

ISBN: 1565922387Supplemental ContentCatalog PageErrata