Working with variables

The debugger lets you view and edit the behavior of your variables while stepping through your code. The debugger provides a Debugger Details pane to display the different kinds of variables used in stored procedures. The Debugger Details pane appears at the bottom of Sybase Central when Sybase Central is running in Debug mode.

Local variables

To view variable values

  1. Connect to the database as a user with DBA authority.

  2. In the left pane, double-click Procedures & Functions.

  3. Select a procedure.

  4. Choose Mode » Debug.

  5. In the Which User Would You Like To Debug field, type * to debug all users, or type the name of the database user you want to debug.

  6. In the right pane, click the line where you want to insert the breakpoint.

    A cursor appears in the line where you clicked

  7. Press F9.

    A red circle appears to the left of the line of code.

  8. In the Debugger Details pane, click the Local tab .

  9. In the left pane, right-click the procedure and choose Execute From Interactive SQL. The variables, along with their values, appear on the Local tab.

Other variables

Global variables are defined by SQL Anywhere and hold information about the current connection, database, and other settings. They appear in the Debugger Details pane on the Global tab.

For a list of global variables, see Global variables.

Row variables are used in triggers to hold the values of rows affected by the triggering statement. They appear in the Debugger Details pane on the Row tab.

For more information about triggers, see Introduction to triggers.

Static variables are used in Java classes. They are appear on the Statics tab.

The call stack

It is useful to examine the sequence of calls that has been made when you are debugging nested procedures. You can view a listing of the procedures on the Call Stack tab.

To display the call stack

  1. Connect to the database as a user with DBA authority.

  2. In the left pane, double-click Procedures & Functions.

  3. Select a procedure.

  4. Choose Mode » Debug.

  5. In the Which User Would You Like To Debug field, type * to debug all users, or type the name of the database user you want to debug.

  6. In the right pane, click the line where you want to insert the breakpoint.

    A cursor appears in the line where you clicked

  7. Press F9.

    A red circle appears to the left of the line of code.

  8. In the Debugger Details pane, click the Local tab .

  9. In the left pane, right-click the procedure and choose Execute From Interactive SQL.

  10. In the Debugger Details pane, click the Call Stack tab.

    The names of the procedures appear on the Calls Stack tab. The current procedure is shown at the top of the list. The procedure that called it is immediately below.