O'Reilly logo

Advanced Oracle PL/SQL Programming with Packages by Steven Feuerstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.11. PLVfile: Operating System I/O Manager

The PLVfile (PL/Vision FILE) package manages operating system I/O by providing a layer of code around Oracle's builtin UTL_FILE package. See Chapter 13 for details.

5.11.1. Package constants and exceptions

max_line_size CONSTANT INTEGER := 1000;

The maximum size of a line allowed to be read or written with PLVfile.

max_line VARCHAR2(1000);

I had to "hard code" the 1000 again in this declaration because you must supply a literal when you declare a length for a VARCHAR2 string. Predefined variable you can use to anchor declarations of local variables in your own programs that will hold the maximum length line allowed in PLVfile.

c_append CONSTANT VARCHAR2(1) := 'A';
c_read CONSTANT VARCHAR2(1) := 'R';
c_write CONSTANT VARCHAR2(1) := 'W';

The different types of file access allowed with the UTL_FILE builtin package (A = append to existing lines in file, R = read-only from file and W = write over existing contents of file).

c_unixdelim CONSTANT VARCHAR2(1) := '/';
c_dosdelim CONSTANT VARCHAR2(1) := '\';

Predefined operating system directory/path delimiters for UNIX and MS-DOS.

5.11.2. Trace PLVfile activity

PROCEDURE show;

Turns on the trace of PLVfile activity.

PROCEDURE noshow;

Turns off the trace of PLVfile activity (default setting).

FUNCTION showing RETURN BOOLEAN;

Returns TRUE if you are currently tracing PLVfile activity.

5.11.3. Setting the operating system delimiter

PROCEDURE set_delim (delim_in IN VARCHAR2);

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required