Chat now with support
Chat with Support

Toad for Oracle 13.1.1 - Getting Started Guide

Welcome to Toad Toad Resources Required Privileges Create and Manage Database Connections Editor Basics Schema Browser Basics Data Grid Basics Work with Data Work with Database Objects Work with Code
Write Statements and Scripts Work with the Query Builder Execute Statements and Scripts Save Statements (SQL Recall) Work with PL/SQL Objects Debug Analyze Code Optimize SQL
Customize your Toad Environment Use Other Quest Software Products with Toad

Add a Watch

Work with Code > Debug > Set Watches > Add a Watch

To add a watch from the Editor

Note: If the Watches window was not open, you will need to open it to view watches.

  1. Click a variable in the Editor.
  2. Do one of the following:
    • Click image\Icon_-_add_watch.gif in the toolbar.
    • Right-click in the Editor, select Debug and then Add Watch at Cursor.
    • Press CTRL+F5 to add the variable at the cursor to the list of watches. The watch is added but the Watch Properties dialog box does not display.

To add a watch from the Watches window

Right-click and select the Add Watch menu item.

To add a watch from the Debug Menu

  1. Click in the variable you want to watch.
  2. From the Debug menu, select Add Watch at cursor.

    Note: If text is selected when Add Watch at Cursor is chosen, Toad sets the watch on the selected text. If no text is selected it uses the text under the cursor. This change occurs so that if you have a recordname.fieldname, you can highlight only recordname to set a watch on it. If you have an expression like v_List(2), where v_List is a varray, then you can highlight the entire expression to put a watch on it.

 

Use Smart Watches

Work with Code > Debug > Set Watches > Use Smart Watches

Toad can automatically watch every variable in the active procedure or function. If you step into a new tab, the smart watches window refreshes with the values on the new tab.

Smart watches are disabled by default and display collapsed.

If the smart watch window contains cursors or records, the cursor/record is listed as a node and each individual item as an entry underneath it. These are, by default, displayed collapsed. You can expand them by clicking the + sign beside the node.

To enable smart watches

In the Watches window, select the Enable Smart Watches checkbox. About Watches

Configure the Smart Watch window

By default, watches and smart watches are arranged side by side in the Watches desktop panel. You can also flip the watch window to show watches over smart watches instead of watches next to smart watches (the default).

To flip the watch panels

Click .

Move Smart Watches to the Watch panel

Unlike standard watches, smart watches are not saved when you leave the window as they are created dynamically from the code you are actively using. However, if you want a watch to persist when you move into a different procedure or function, you can drag the watch from the smart watches panel to the watches panel. In the case of a watch that contains multiple parts, you choose to drag the node, which will copy everything under it, or only one of the items within the node.

To move a smart watch to the watch window

  • Do one of the following:
  • Drag the smart watch from the smart watches panel to the watches panel.
  • Select a watch, right click, select Add.
  • Select a Smart Watch, click the Add Watch button on the toolbar.

 

Analyze Code

Work with Code

Toad provides an intuitive and efficient way to write, run, and test your SQL and PL/SQL code. Toad supports efficient code management for a single developer or a whole team of developers.

 

About Code Analysis

Work with Code > Analyze Code > About Code Analysis

Code Analysis is an automated code review and analysis tool. It enables individual developers, team leads, and managers to ensure that the quality, performance, maintainability, and reliability of their code meets and exceeds their best practice standards.

  • Code Analysis is available in the Editor, which ensures code quality from the beginning of the development cycle. In the Editor, Code Analysis evaluates how well a developer's code adheres to project coding standards and best practices by automatically highlighting errors and suggesting smarter ways to build and test the code.

    Analyze Code in the Editor

  • Toad also provides a dedicated Code Analysis window, where you can perform more detailed analysis, evaluate multiple scripts at the same time, and view a detailed report of the analysis.

    See Perform Detailed Code Analysis in the online help for more information.

Notes:

  • This feature is available in the Professional Edition and higher.
  • This feature was named CodeXpert prior to Toad 11.

Rules and Rule Sets

Code Analysis compares code against a set of rules for best practices. These rules are stored in rule sets.

The Code Analysis rules and rule sets can be adjusted to suit the requirements of different projects. Regardless of whether developers are responsible for their own code quality or if this needs to be managed centrally, Code Analysis can be adapted to fit either need.

See Create or Edit Rule Sets in the online help for more information.

Code Analysis Metrics

Code Analysis uses a variety of metrics to evaluate code, including the following:

  • Computational Complexity (Halstead Volume)—Measures a program module's complexity directly from source code, with emphasis on computational complexity. The measures were developed by the late Maurice Halstead as a means of determining a quantitative measure of complexity directly from the operators and operands in the module. Among the earliest software metrics, they are strong indicators of code complexity. Because they are applied to code, they are most often used as a maintenance metric.
  • Cyclomatic Complexity (McCabe's)—Cyclomatic complexity is the most widely used member of a class of static software metrics. It measures the number of linearly-independent paths through a program module. This measure provides a single ordinal number that can be compared to the complexity of other programs. It is independent of language and language format.
  • Maintainability Index (MI)—Quantitative measurement of an operational system's maintainability is desirable both as an instantaneous measure and as a predictor of maintainability over time. This measurement helps reduce or reverse a system's tendency toward what is known as code entropy or degraded integrity, and to indicate when it becomes cheaper and/or less risky to rewrite the code than to change it. Applying the MI measurement during software development can help reduce lifecycle costs.

The Code Analysis Report includes detailed descriptions of the code metrics and how they work.

See Perform Detailed Code Analysis in the online help for more information.

Get more information

See the online help for additional topics on Code Analysis.

 

Related Documents