6.6 The Predefined Constants

Chapter 6
PLV: Top-Level Constants and Functions
 

In addition to the predefined datatypes, the PLV package offers a set of constants that are used throughout PL/Vision. These constants define the type of input or output repository you want to use in a given situation. These constants are used in PLVio, PLVlog, and PLVexc. The input/output options in PL/Vision are shown in the following table.

Description

Constant

Database table

dbtab

PL/SQL table

pstab

Operating system file

file

VARCHAR2 string

string

Standard output

stdout

For example, if you want to define the target repository of the PLVio package to be a PL/SQL table, you will issue this command:

SQL> exec PLVio.settrg (PLV.pstab);

If you want PLVlog to write its information to an operating system file, you will execute this command:

SQL> exec PLVlog.tofile;

which in turn sets the v_log_type variable to the PLV.file constant.

Special Notes on PLV

Once you build a package like this, you will find yourself constantly adding to it. Be careful not to throw in constants and programs that really do have a place in another, less generic package.

The boolstg, errm, and now functions of PLV can all be used from within SQL statements, since the package specification for PLV includes calls to the RESTRICT_REFERENCES pragma.

The errm function is a good example of how you can use a layer of your own PL/SQL code around native PL/SQL builtins (SQLERRM) to make the information more widely accessible (i.e., callable from within SQL statements).


6.5 The Predefined Datatypes7. p: A Powerful Substitute for DBMS_OUTPUT

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



Advanced Oracle PL. SQL Programming with Packages
Advanced Oracle Pl/Sql: Programming With Packages (Nutshell Handbook)
ISBN: B00006AVR6
EAN: N/A
Year: 1995
Pages: 195
Authors: Steven Feuerstein, Debby Russell
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net