Inspecting and Modifying Variables

You can inspect the values of both local variables (declared in a method) and class static variables in the debugger.

You can display class-level variables (static variables) in the Debugger window and inspect their values. For more information, see the debugger online Help.

You can inspect the values of local variables in a method as you step through the code, to better understand what is happening.

Note:

To use the Java examples, you must have the Java example classes installed into the demo database.

  1. Set a breakpoint at the first line of the JDBCExamples.Query method. This line is as follows:
    int max_price = 0
  2. In Interactive SQL, execute the method again:
    SELECT JDBCExamples.Query()

    The query executes only as far as the breakpoint.

  3. Press F7 to step to the next line. The max_price variable has now been declared and initialized to zero.
  4. If the Locals window does not appear, choose Window > Locals to display it.

    The Locals window shows that there are several local variables. max_price has a value of zero. All other variables are listed as variable not in scope, which means they are not yet initialized.

  5. In the Locals window, double-click the Value column entry for max_price, and change the value of max_price to 45.

    The value 45 is larger than any other price. Instead of returning 24, the query now returns 45 as the maximum price.

  6. In the Source window, press F7 repeatedly to step through the code. The values of the variables appear in the Locals window. Step through until the stmt and result variables have values.
  7. Expand the result object by clicking the icon next to it, or by setting the cursor on the line and pressing Enter. This displays the values of the fields in the object.
  8. When you have experimented with inspecting and modifying variables, press F5 to complete the execution of the query and finish the tutorial.