You can test the hypothesis that the problem is the lack of initialization for top_value right in the debugger, without changing the procedure code.
To test the hypothesis
In the Debugger Details window, click the Local tab.
Click the Top_Value variable and type 3000 in the Value field.
Press F11 repeatedly until the Value field of the This_Value variable is greater than 3000.
Click the breakpoint so that it turns gray.
Press F5 to execute the procedure.
The Interactive SQL window appears again. It shows the correct results.
top_company | top_value |
---|---|
Chadwicks | 8076 |
The hypothesis is confirmed. The problem is that the top_value is not initialized.
To fix the bug
Choose Mode » Design.
In the right pane, locate the following statement:
OPEN cursor_this_customer; |
Type a new line that initializes the top_value variable:
SET top_value = 0; |
Choose File » Save.
Execute the procedure again, and confirm that Interactive SQL displays the correct results.
You have now completed the lesson. Close any open Interactive SQL windows.
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |