Debugging a Procedural Object

You can debug a procedural object after you set breakpoints.

By setting breakpoints, you can suspend and resume execution of a procedural object during debugging, which enables you to observe and evaluate the procedural object's variables and expressions.

There can be one active connection to SQL Anywhere and Sybase IQ during a debug session. Disconnect other SQL Anywhere or Sybase IQ connection profiles before debugging.

You can use the Debug view toolbar during a debug session to resume, suspend, or terminate execution of a procedural object. After you set the breakpoints, the Debug command switches the perspective to the Database Debug perspective and suspends execution at the first breakpoint.

Similar to a launch configuration, a Database Debug session remembers the SQL statement each time you want to test your object. In addition, it allows you to examine and manipulate variables and parameters and execute procedural objects one breakpoint at a time.


Note: You can disable the Adaptive Server Enterprise SQL debugger using trace flag 4083. The trace flag is a startup-only traceflag and has to be specified while starting up Adaptive Server Enterprise. Turning the trace flag on or off while Adaptive Server Enterprise is running does not affect the state of the debugger.
  1. Open the procedural object and set appropriate breakpoints.
  2. In the Source page, right-click and select Debug.
  3. (Optional) Change parameters as necessary.
  4. If prompted, click Yes to confirm a perspective switch to the Database Debug perspective.
  5. Use the following controls to navigate procedural object SQL code:
    Table 1. Methods of terminating or suspending procedural object execution
    Icon Name Action
    suspend execution between breakpoints Suspend Suspends execution between breakpoints or before the debug operation reaches the end of the procedure.
    terminate execution of procedural object Terminate Terminates execution of the procedural object.
    disconnect client debugger from remote debug client Disconnect Disconnects a client debugger from a remote debug target.
    clear terminated debug targets from SQL Editor Remove All Terminated Launches Clears all terminated debug targets.
    resume a suspended thread Resume Resumes a suspended thread.
    Arrow indicates highlighting the statement Step Into The next statement on the currently-selected line to be executed is invoked, and execution suspends at the next executable line in the procedural object. If the statement is another stored procedure, as in a nested stored procedure, that procedural object loads into the editor window, and the first statement in that stored procedure is highlighted. The statement is highlighted at each step.
    Arrow indicates highlighting the statement Step Over Skips the present highlighted statement and executes the next line in the same procedural object. If execution is at the end of a procedural object, execution continues in the procedural object from which the current procedural object was called. The cursor jumps to the declaration of the procedural object and highlights its line.
    Arrow indicates highlighting the statement Step Return Returns the highlight to the previous stored procedure call level. Step Return is usually used in conjunction with Step Into.
  6. As you step through the code, examine or change the values of local variables.

    In the upper right corner of the Database Debug perspective, the Variables view tracks the variables. To change the value of a variable, right-click the variable in this view, and select Change. Enter a new value for the variable and click OK.

  7. (Optional) Navigate to a particular statement or variable, click the statement in the Outline view, or expand Parameters and click the variable.
  8. (Optional) Execute one or more SQL statements by highlighting the code, right-clicking, and selecting Execute Selection.
Next 

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

Related tasks
Dumping Debug Variables and Referenced Table Data
Debugging a Table in Referenced Tables View
Debugging a Trigger
Debugging an External Client
Related reference
SQL Debugger Preferences


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com