|Oracle9i OLAP Services Developer's Guide to the OLAP DML
Release 1 (9.0.1)
Part Number A86720-01
Debugging Programs, 6 of 6
If you do not want to trace the execution of a program from its beginning, then you can select a point in the program where you want to start tracing. You use the WATCH command to select a watch point. You can enter a WATCH command in the command input window in OLAP Worksheet.
The WATCH command sets a watch point as a Boolean expression that is monitored by the debugging environment. When the Boolean expression becomes true, the debugging environment suspends execution of the program and displays the double-line arrow prompt in the output pane of the command input window in OLAP Worksheet, from which you can examine the subsequent execution of the program.
To set a watch point, you specify the Boolean expression to be monitored, and, optionally, the name of a program in which to watch the expression. The Boolean expression can be something integral to your program, or you can include a watch point in the program just for debugging.
In the sample program called QUARTER.RPT, a command limits the QUARTER dimension. You can use the results of that LIMIT command as a watch point as outlined below.
watch for statlen(quarter) eq 1 in quarter.rpt watch list 1: Watch For STATLEN(QUARTER) EQ 1 within QUARTER.RPT ENABLED
Note: The WATCH LIST command displays a list of the current watch points in the output pane in the command input window. When you set a watch point, it is assigned a watch number and is automatically enabled as indicated by the word ENABLED at the right end of the output line in the above example.
Once a watch point expression is TRUE, the debugging environment disables it.
You can enable it again with another WATCH command that specifies the watch number.
Instead of using an integral part of the program as a watch point, you can set up a special watch point specifically for the purpose of debugging.
Suppose you declare a local variable called WPOINT at the start of QUARTER.RPT and then set WPOINT to 1 at the point in the program where you want to start examining its execution. You can also set WPOINT to other values in other parts of your program to establish several watch points for different purposes.
describe quarter.rpt DEFINE QUARTER.RPT PROGRAM PROGRAM argument userchoice month variable wpoint integer "Define watch point trap on finish pushlevel 'quarter' push decimals month quarter limit month to userchoice wpoint = 1 "Set watch point limit quarter to month report down district across product: - heading 'Total Sales' - total(sales, district product quarter) finish: poplevel 'quarter' END
If you now set a watch point as follows and run QUARTER.RPT, then the debugger suspends execution at the point where WPOINT is set to 1 and displays the double-line arrow prompt.