Oracle9i Supplied PL/SQL Packages and Types Reference Release 1 (9.0.1) Part Number A89852-02 |
|
DBMS_DEBUG, 10 of 27
The best way to get the source code (for a program that is being run) is to use SQL. For example:
DECLARE info DBMS_DEBUG.runtime_info; BEGIN -- call DBMS_DEBUG.SYNCHRONIZE, CONTINUE, -- or GET_RUNTIME_INFO to fill in 'info' SELECT text INTO <buffer> FROM all_source WHERE owner = info.Program.Owner AND name = info.Program.Name AND line = info.Line#; END;
However, this does not work for non-persistent programs (for example, anonymous blocks and trigger invocation blocks). For non-persistent programs, call SHOW_SOURCE
. There are two flavors: one returns an indexed table of source lines, and the other returns a packed (and formatted) buffer.
There are two overloaded SHOW_SOURCE
procedures.
DBMS_DEBUG.SHOW_SOURCE ( first_line IN BINARY_INTEGER, last_line IN BINARY_INTEGER, source OUT vc2_table);
An indexed table of source-lines. The source lines are stored starting at first_line
. If any error occurs, then the table is empty.
This second overloading of SHOW_SOURCE
returns the source in a formatted buffer, complete with line-numbers. It is faster than the indexed table version, but it does not guarantee to fetch all the source.
If the source does not fit in bufferlength (buflen
), then additional pieces can be retrieved using the GET_MORE_SOURCE
procedure (pieces
returns the number of additional pieces that need to be retrieved).
DBMS_DEBUG.SHOW_SOURCE ( first_line IN BINARY_INTEGER, last_line IN BINARY_INTEGER, window IN BINARY_INTEGER, print_arrow IN BINARY_INTEGER, buffer IN OUT VARCHAR2, buflen IN BINARY_INTEGER, pieces OUT BINARY_INTEGER);
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|