7.2 The Line Seperator

Chapter 7
p: A Powerful Substitute for DBMS_OUTPUT
 

7.2 The Line Separator

When you compile and store code in SQL*Plus, any blank lines in your source code are discarded. This annoying "undocumented feature" wreaks havoc at compile time. If there are any compile errors, the line number stored in USER_ERRORS and returned by SHOW ERRORS almost never matches the line number of the code in your operating system file. What an annoyance!

The situation gets even worse when you really want to preserve those blank lines for readability. The PLVhlp package, for example, provides an architecture for online help. Without blank lines in the help text, it would be very difficult to make this text understandable. It would be awfully nice to be able to preserve those blank lines -- or at least make a line appear to be blank when displayed.

The p package recognizes this need and allows you to specify a line separator character. If a line of text passed to p.l consists only of the line separator character, it is displayed as a blank line.

You set the line separator with the set_linesep procedure, whose header is:

PROCEDURE set_linesep (linesep_in IN VARCHAR2);

You can retrieve the current line separator character with the linesep function:

FUNCTION linesep RETURN VARCHAR2;

The default line separator character is =. As a result, if I execute the following anonymous block,

BEGIN    p.l ('this');    p.l ('=');    p.l ('is');    p.l ('=');    p.l ('separated!'); END; /

I see this output:

this is separated!


7.1 Using the l Procedure7.3 The Output Prefix

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