SQL Editor Output Area
The data grid has a tool palette that enables the user to scroll up or down the returned rows, add rows, and delete rows (see Figure 3.6). Notice the light at the cursor along the bottom of the SQL Editor screen (see the cursor position in Figure 3.7). If this is red, then the data in this data grid cannot be changed and the commit/rollback/add/delete rows buttons will be grayed out. If the pseudo column ROWID was selected in the SQL, then this light will be green and the commit/rollback/add/delete rows palette will not be grayed out and the data can be changed.
FIGURE 3.6 Data Tool palette
FIGURE 3.7 Toad data grid
Many output tabs are available in Toad. These tabs usually automatically display when a request occurs for the data contained to be displayed, such as when you execute the PL/SQL profiler. In that case the Profiler tab should automatically appear. Figure 3.8 shows this list.
FIGURE 3.8 Available output tabs
You can easily display or hide these tabs. Right-click the tab line to see all the tabs available. Simply adjust per your needs. You can also right-click the editor panel and select Desktop from that pop-up menu to get the same list.
The Breakpoints, Call Stack, and Watches tabs are all associated with the PL/SQL Debugger (covered in Chapter 6, “Working with PL/SQL”). The Data Grid tab is associated with any SQL select statement execution. Data grids appear throughout Toad, and the options that are available for this data grid are also available for any data grid. The DBMS Output tab shows any DBMS_OUTPUT.Put_Line output from a PL/SQL routine. The Explain Plan tab (discussed later this chapter and again in Chapter 10, “Toad as a SQL Tuning Tool”) shows the SQL execution plan; it also has many display options. To populate this tab, click the Explain Plan button . The Messages tab shows any output from the executed SQL, including error messages (its real value). The Navigator tab displays the Navigator panel to the left of the Editor window. The Profiler tab is associated with the PL/SQL Profiler discussed in Chapter 6. The Query Viewer tab shows SQL and PL/SQL that was executed in the SQL window and some interesting statistics such as how long it took to execute. This information is useful for either rerunning that exact same SQL or when doing performance tuning (to easily compare one SQL execution with another). The REF CURSOR Results tab is also associated with PL/SQL execution. The Script Output tab shows character-mode output when the Run as Script button is clicked for execution. Team Coding illustrates others’ participation in coding of particular PL/SQL code and is covered in Chapter 7, “Miscellaneous Tools.” The Trace tab enables SQL statistics and/or SQL Trace files to be generated and displayed for this particular SQL statement. Notice that you can enable both Auto Trace and SQL Trace from this tab (see Figure 3.9). The Trace tab is discussed in detail in Chapter 10. The remaining items on this menu deal with these tabs themselves—which ones appear when Toad starts up, where they appear—and this includes saving the changes for the next time Toad is started, as well as restoring the default settings from when Toad was originally installed.
FIGURE 3.9 Toad Auto Trace
Clicking the Explain Plan button on the lower-left SQL Editor toolbar shows the Oracle explain plan for the SQL just executed. Right-clicking in this window enables the display to be adjusted.
The Auto Trace tab provides a variety of SQL runtime statistics. You can enable this feature using the check box or right-click in the editor window and select Auto Trace to enable, and then re-execute the SQL to populate the Auto Trace panel. Notice that you can also run a SQL trace on this particular SQL from the SQL Trace sub-tab. This feature needs the ALTER SESSION privilege; SQL trace is covered in detail in Chapter 10. Toad will run the SQL trace and either bring up the output using the TKProf Wizard or the Trace File browser, depending on which feature of Toad you have purchased.