Skip Headers
Oracle® OLAP DML Reference
11g Release 1 (11.1)

Part Number B28126-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Testing and Debugging Programs

Even when your program compiles cleanly, you must also test the program by running it. Running a program helps you detect errors in statements with ampersand substitution, errors in logic, and errors in any nested programs.

To test a program by running it, use a full set of test data that is typical of the data that the program processes. To confirm that you test all the features of the program, including error-handling mechanisms, run the program several times, using different data and responses. Use test data that:

Generating Diagnostic Messages

Each time you run the program, confirm that the program executes its statements in the correct sequence and that the output is correct. As an aid in analyzing the execution of your program, you can include SHOW statements in the program to produce diagnostic or status messages. Then delete the SHOW statements after your tests are complete.

When you detect or suspect an error in your program or a nested program, you can track down the error by using the debugging techniques that are described in the rest of this section.

Identifying Bad Lines of Code

When you set the BADLINE option to YES, additional information is produced, along with any error message when a bad line of code is encountered. When the error occurs, the error message, the name of the program, and the program line that triggered the error are sent to the current outfile. You can edit the specified program to correct the error and then run the original program. See Example 6-4, "Using the BADLINE Option" for an example of using BADLINE.

Sending Output to a Debugging File

When your program contains an error in logic, then the program might execute without producing an error message, but it executes the wrong set of statements or produces incorrect results. For example, suppose you write a Boolean expression incorrectly in an IF statement (for example, you use NE instead of EQ). The program executes the statements you specified, but it does so under the wrong conditions.

To find an error in program logic, you often need to see the order in which the statements are being executed. One way you can do this is to create a debugging file and then examine the file to diagnose any problems in your programs by issuing the following DML statements:

  1. Create a debugging file, by issuing an DBGOUTFILE statement. A V statement merely creates a file for debugging.

  2. Specify that you want each program line to be sent to the debugging file when a line executes by setting the PRGTRACE option to YES.

  3. (Optional) When you want the debugging file to interweave the program lines with both the program input and error messages, set the ECHOPROMPT option to YES.