home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


4.2 PL/Vision Package Bundles

PL/Vision Lite consists of 32 PL/SQL packages. From a conceptual standpoint, the various packages are grouped into three bundles: building blocks, developer utilities, and plug-and-play components. These packages in each of these bundles are summarized in the following sections. Chapter 5, PL/Vision Package Specifications , contains a full summary of all package specifications.

NOTE: Some of the packages listed in the following tables are not described in detail in this book. In cases in which neither the package conception nor its implementation offered any additional insights that would help you build your own packages, I elected to omit the discussion from the book. For more details about these packages (indicated by * in the tables), see the PL/Vision Online Reference on the companion disk.

4.2.1 Building Blocks

The building block packages provide low-level functionality upon which other packages in PL/Vision are built. You can, of course, also use these building blocks to construct your own applications. Examples of building block packages include an interface to PL/SQL tables, string parsers, a file I/O manager, and a message handling mechanism.


Table 4.1: PL/Vision Building Block Packages

Package

Description

p

Offers a feature-rich and minimal-typing substitute for the DBMS_OUTPUT package.

PLV

Top-level package for PL/Vision. Contains constants and generic utilities for use throughout the library.

PLVchr

Provides information about single characters in a string. You can display the ASCII codes for characters in a string and perform other operations relating to individual characters.*

PLVfile

Manages operating system file I/O. PLVfile provides a layer of code around the UTL_FILE builtin package and offers some very high-level capabilities, such as a file copy. Use this package only if you are using Oracle Server Release 7.3 and above.

PLVio

Generalized input/output package used to both read from and write to repositories for PL/SQL source code. For example, you can use PLVio, via the PLVcase package, to read a program from its operating system file, convert keywords to upper-case, and then store it in the database.

PLVlex

Lexical analysis and parsing package. Recognizes lexical elements of the PL/SQL language and can be used to read one PL/SQL identifier at a time.*

PLVlst

Generic list manager for PL/SQL that's built on PL/SQL tables. Following the specification of the LIST package of Oracle Developer/2000, this package provides a comprehensive interface to lists in PL/SQL .*

PLVmsg

Stores standard messages for use in an application. Use this package to consolidate all different kinds of message text with which you can associate a number (such as error number). You can also use PLVmsg to override standard Oracle error messages with your, more application-specific information.

PLVobj

Programmatic interface to the ALL_OBJECTS data dictionary view. This package encapsulates logic for specifying and reading source code for a given object. It provides an excellent model for building a package around a view or cursor. PLVobj even implements a kind of dynamic cursor FOR loop through a procedure with the loopexec program.

PLVprs

Performs string parsing actions. This is the most generic of the string manipulation packages of PL/Vision.

PLVprsps

Parses PL/SQL source code. You can parse a single string or an entire program unit. The parsed tokens are placed in a PL/SQL table, which can then be used as the basis for further analysis or conversion of the code.

PLVstk

Generic stack manager package, built on PLVlst. Provides a full set of operations for both FIFO (first-in-first-out) queues and LIFO (last-in-first-out) stacks.*

PLVtab

Provides an interface to predefined PL/SQL table structures. Also allows you to easily and flexibly display the contents of PL/SQL tables.

PLVtkn

Package interface to the PLV_token table, which contains information about tokens, particularly keywords, in the PL/SQL language. Use PLVtkn to determine if an identifier is a keyword or a reserved word, and even the type of keyword (syntax, builtin, symbol, etc.).

4.2.2 Developer Utilities

The developer utilities of PL/Vision are self-contained utilities that you can use to improve your development environment. Examples of building block packages include a PL/SQL code generator and an online help delivery mechanism for PL/SQL programs.


Table 4.2: PL/Vision Developer Utility Packages

Package

Description

PLVcase

Converts the case of PL/SQL code to the UPPER-lower method. You can convert a single token, a line, a program, or a set of programs.

PLVcat

Catalogues the contents of PL/SQL code, placing the results in one of two database tables. You can either catalogue the list of elements referenced by a particular program (the PLVrfrnc table) or the list of elements defined in the specification of a package (the PLVctlg table).

PLVddd

Dumps Data Definition Language (DDL) syntax from a particular schema. Allows you to recreate database objects easily in other schemas. You can also use output from PLVddd to compare data structures between schemas or analyze changes over time.*

PLVgen

Generates PL/SQL program units and SQL*Plus scripts. This package can greatly improve developer productivity, adherence to coding standards and best practices, and the overall quality of code produced.

PLVhlp

Provides an architecture by which developers can provide online help for their PL/SQL programs to their (developer) users. Using this package, you can make comment text in your source code available in a structured way to users of your code.

PLVtmr

Allows you to measure elapsed time of PL/SQL code down to the hundredth of a second. This package offers a programmatic layer around the GET_TIME function of the builtin DBMS_UTILITY package.

PLVvu

Multifaceted view package. Shows you the errors in a stored object compile, or specified lines of source code from the data dictionary, etc. Offers a convenient substitute for the SHOW ERRORS command of SQL*Plus.

4.2.3 Plug-and-Play Components

The most advanced packages in PL/Vision are the plug-and-play components. These packages allow developers to replace whole sections of code with programs from PL/Vision packages. In essence, you plug in PL/Vision code and immediately gain benefits in your application, employing a declarative style of programming in a procedural language. The best example of a PL/Vision plug-and-play component is PLVexc, which provides very high-level exception handling programs.


Table 4.3: PL/Vision's Plug-and-Play Packages

Package

Description

PLVcmt

Offers a programmatic interface to the execution of commits, rollbacks, and the setting of savepoints. Gives you more flexibility than calling the corresponding builtins. You can, for example, opt to turn off commits in your application without changing any of your code.

PLVdyn

Offers a high-level interface to the DBMS_SQL builtin package. You can perform many complex operations with a call to a single PLVdyn program. This package is strongly recommended over direct use of the DBMS_SQL builtin packages.

PLVdyn1

Built upon PLVdyn, this package encapsulates dynamic SQL operations that require single bind variables (PLVdyn does not work with any bind variables).

PLVexc

Generic exception-handling package. Instead of writing your own exception handlers, just call one of the PLVexc prebuilt, high-level handlers. Your errors will be displayed or written to the PL/Vision log, as you specify.

PLVfk

Provides foreign key management, including a single function to perform lookups of foreign keys for any table and any structure. This package can greatly reduce the volume of code you have to write to manage foreign keys. The dynamic SQL in PLVfk works surprisingly quickly.

PLVlog

This package provides a generic logging facility for PL/Vision-based applications. With PLVlog, you can write information to a database table, PL/SQL table, operating system file (for PL/SQL Release 2.3 and above), or standard output.

PLVrb

Provides a programmatic interface to rollback and savepoint processing. Allows you to specify savepoints by variable, instead of hard-coding identifiers in your code. You can also opt to turn off rollbacks in your application without changing any of your code.

PLVtrc

Provides an execution trace for PL/SQL programs. Mirrors the overloading of the p package to allow you to show different kinds of data. Offers startup and terminate procedures that allows PLVtrc to maintain its own execution call stack .


Previous: 4.1 What Is PL/Vision? Advanced Oracle PL/SQL Programming with Packages Next: 4.3 Installation Instructions
4.1 What Is PL/Vision? Book Index 4.3 Installation Instructions

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