Debugging a Procedural Object

Once you have set the breakpoints for a procedural object (see Manipulating Breakpoints) in Database Development perspective, you can begin the debugging process. Database Debug differs from Run mode in that you can suspend and resume execution, inspect variables, and evaluate expressions. When a thread is suspended, you can use the step controls to move through the execution of the program. If a breakpoint is encountered while you are performing a step operation, execution is suspended at the breakpoint and the step operation is ended.

You can only have one active connection to Adaptive Server Anywhere and Sybase IQ during a debug session. Disconnect other ASA or ASIQ connection profiles before debugging.

  1. Once you have set the breakpoints, select Debug from:

    • the main toolbar. This choice executes the procedural object as is.

    • the SQL Editor context menu. This option brings up the Configure Parameters dialog, where you can change parameters manually.

    • the Run menu. This selection brings up the Create, Manage, and Run Configurations page, from which you can set up a new launch session. (See Launching a Database Debug Session on how to proceed.)

  2. If you made one of the last two choices for step 1, you are prompted to confirm a perspective switch to Database Debug perspective. Click Yes.

  3. Use the following controls to navigate procedural object SQL code in SQL Editor:

    • Step Into highlights the statement. If the statement is another stored procedure (nested stored procedure), that procedure object will be loaded into SQL Editor, and the first statement in that stored procedure will be highlighted. The statement is highlighted at each step.

    • Step Over skips the present highlighted statement and executes the next line in the same method. If execution is at the end of a method, execution continues in the method from which the current method was called. The cursor jumps to the declaration of the method and highlights its line.

    • Step Return returns the highlight to the previous stored procedure call level. Step Return is usually used in concert with Step Into.

    • Resume continues execution to the next breakpoint.

  4. To debug procedural objects as you step through the code, you must examine or change the values of local variables. In the upper right corner of the Database Debug perspective, Variables tracks the variables in the expressions that Database Debug has evaluated. To change the value of a variable, double-click its name in this view. When the Set Value dialog appears, enter a new value for the variable and click OK.

    Note

    The code is highlighted in SQL Editor, where you can execute only that portion by choosing Execute Selection from the context menu.

  5. To navigate easily to a particular statement or variable, click on that statement in the Outline view, or expand Parameters and click on that variable.

    The statement or variable is highlighted in the editor window.

Next: Examine and edit tables referenced in the object you are debugging.

Using Database Debug

Viewing Referenced Tables While Debugging

Debugging an ASA Trigger

Database Debug Views

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com