Advanced Oracle PL/SQL Programming with Packages

Advanced Oracle PL/SQL Programming with PackagesSearch this book
Previous: 5.24 PLVstk: Stack ManagerChapter 5
PL/Vision Package Specifications
Next: 5.26 PLVtkn: Token Table Interface
 

5.25 PLVtab: Table Interface

The PLVtab (PL/Vision TABle) package makes it easier to declare, use, and display the contents of PL/SQL tables by providing predefined PL/SQL table types and programs. See Chapter 8, PLVtab: Easy Access to PL/SQL Tables for details.

5.25.1 Predefined table TYPEs

Since these table TYPES are already defined in the PLVtab package, you can use them to declare your own PL/SQL tables -- and not deal with the cumbersome syntax.

TYPE boolean_table IS TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;
TYPE date_table IS TABLE OF DATE INDEX BY BINARY_INTEGER;
TYPE integer_table IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;
TYPE number_table IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
TYPE vc30_table IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
TYPE vc60_table IS TABLE OF VARCHAR2(60) INDEX BY BINARY_INTEGER;
TYPE vc80_table IS TABLE OF VARCHAR2(80) INDEX BY BINARY_INTEGER;
TYPE vc2000_table IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER;
TYPE vcmax_table IS TABLE OF VARCHAR2(32767) INDEX BY BINARY_INTEGER;

5.25.2 The empty PL/SQL tables

An empty PL/SQL table is a structure in which no rows have been defined. The only way to delete all the rows from a PL/SQL table is to assign an empty table to that table. You can use these predefined PL/SQL tables to accomplish this task easily.

empty_boolean boolean_table;
empty_date date_table;
empty_integer integer_table;
empty_number number_table;
empty_vc30 vc30_table;
empty_vc60 vc60_table;
empty_vc80 vc80_table;
empty_vc2000 vc2000_table;
empty_vcmax vcmax_table;

5.25.3 Toggle for showing header

PROCEDURE showhdr;

Requests that a header be displayed with the contents of the table (the header text is passed in the call to the display procedure). This is the default.

PROCEDURE noshowhdr;

Turns off the display of the header text with the table contents.

FUNCTION showing_header RETURN BOOLEAN;

Returns TRUE if the header is being displayed.

5.25.4 Toggle for showing row numbers

PROCEDURE showrow;

Requests that the row number be displayed with the row contents.

PROCEDURE noshowrow;

Turns off display of the row number (the default).

FUNCTION showing_row RETURN BOOLEAN;

Returns TRUE if the row number is being displayed.

5.25.5 Toggle for showing blanks in row

PROCEDURE showblk;

Requests that blank lines be displayed. A NULL row will display as the p.fornull NULL substitution value. A line consisting only of blanks will be displayed as the word BLANKS.

PROCEDURE noshowblk;

Requests that blank lines be displayed as blank lines.

FUNCTION showing_blk RETURN BOOLEAN;

Returns TRUE if showing the contents of blank lines.

5.25.6 Setting the row prefix

PROCEDURE set_prefix (prefix_in IN VARCHAR2 := NULL);

Sets the character(s) used as a prefix to the text displayed before the value in the table's row (default is NULL).

FUNCTION prefix RETURN VARCHAR2;

Returns the current prefix character(s).

5.25.7 Saving and restoring settings

PROCEDURE save;

Saves the current settings for the toggles to private variables in the package.

PROCEDURE restore;

Restores the settings for the toggles from the saved values.

5.25.8 Displaying a PLVtab table

PROCEDURE display
(tab_in IN boolean_table|date_table|number_table|integer_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);
PROCEDURE display
(tab_in IN
vc30_table|vc60_table|vc80_table|vc2000_table|vcmax_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);

The display procedure is overloaded nine times, for a variety of datatypes. The first version above shows the overloading for non-string datatypes. The second version shows all the different types of string PL/SQL tables supported by the PLVtab.display procedure.


Previous: 5.24 PLVstk: Stack ManagerAdvanced Oracle PL/SQL Programming with PackagesNext: 5.26 PLVtkn: Token Table Interface
5.24 PLVstk: Stack ManagerBook Index5.26 PLVtkn: Token Table Interface

The Oracle Library Navigation

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference
This HTML Help has been published using the chm2web software.