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

7.3 The Output Prefix

PL/Vision works extensively with stored PL/SQL code -- which often has (and should have) lots of indentation to reveal the logical flow of the program. If I use the native, builtin PUT_LINE procedure to display this text, it comes out left-justified; all leading spaces are automatically trimmed by the DBMS_OUTPUT.PUT_LINE builtin. This is not a very useful way to display code.

The p package handles this situation by prefixing all text with a prefix string. As long as the prefix string is not composed entirely of spaces, the leading spaces in your own text will be preserved.

You can set and retrieve the value of the prefix string with these two programs:

PROCEDURE set_prefix (prefix_in IN VARCHAR2 := c_prefix);
FUNCTON prefix RETURN VARCHAR2;

The default prefix (stored in the package constant c_prefix ) is CHR(8), which is the backspace character. This character, like many of the other nonprinting characters in the ASCII code table, displays as a black box in the Windows environment and functions well as a prefix.

You may wish to substitute a different value more appropriate to your operating system. To do this, simply call the set_prefix procedure as shown in the example below:

SQL> exec p.set_prefix ('*');
SQL> exec p.l (SYSDATE);
*May 12, 1996 22:36:55

If you call set_prefix , but do not pass a value, you will set the prefix back to its default.


Previous: 7.2 The Line Separator Advanced Oracle PL/SQL Programming with Packages Next: 7.4 Controlling Output from p
7.2 The Line Separator Book Index 7.4 Controlling Output from p

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










??????????????@Mail.ru