Debugging

White Paper by Marty Weber
mweber11@earthlink.net

SHOW ERRORS
The SHOW ERRORS command will display all of the errors associated with the most recently created stored procedure. This command will check the USER_ERRORS data dictionary view for errors associated with the most recent compilation attempt for the procedural object. SHOW ERRORS will display the line and column number for each error, as well as the text of the error message. Two other data dictionary views of error messages are ALL_ERRORS and DBA_ERRORS.

Using the DBMS_OUTPUT Package
In addition to the debugging information provided by the SHOW ERROR command, you may use the DBMS_OUTPUT public package. This package allows developers to closely follow the execution of a function or procedure by sending messages and values to your screen. DBMS_OUTPUT has three debugging procedures PUT, PUT_LINE, and NEW_LINE. Use PUT_LINE to output a single line of data to the output buffer (usually your screen). To use DBMS_OUTPUT, you must issue this command before executing the procedural object you will be debugging:

SET SERVEROUTPUT ON

To execute the PUT_LINE procedure within your code, you must first list the package name, then the procedure name, as shown in the following example:

DBMS_OUTPUT.PUT_LINE( 'debug test past code middle');