Overview


TOAD provides a number of features that make PL/SQL development easy:

  • Keyboard shortcuts

  • Table and column select lists

  • PL/SQL templates

  • Options for creating and executing PL/SQL procedures or parts of procedures

  • Complete debugging capabilities

  • Complete source code control

The Procedure Editor window gives you the ease and flexibility to create and edit PL/SQL no matter where it exists in the database. Figure 4.1 illustrates the Procedure Editor window, displaying a function stored in the database.

Figure 4.1. The TOAD Procedure Editor window.

This illustration shows the default Procedure Editor. The various buttons at the top perform just about any function (including executing the current SQL, saving the current SQL, and so on). There are three rows of buttons , or three TOAD toolbars . When you hover the mouse over a button, a balloon will appear with a description of its use.

A shortcut is a keystroke or keystrokes that perform a certain function. F1, for example, brings up the TOAD help facility. There is a button on the toolbar for about every shortcut. The savvy TOAD user makes extensive use of these shortcuts.

[ic:keyboard] F1 brings up the TOAD help facility.

Figure 4.2 illustrates the toolbars.

Figure 4.2. TOAD Procedure Editor window toolbars.

The first and third toolbars are the same as the toolbars in the SQL Editor, discussed in Chapter 3. This chapter focuses on the Procedure Editor.


The second (middle) toolbar has buttons for actions that are specific to the Procedure Editor such as compiling, debugging features, and source-code check in/check out. This toolbar contains the following icons:

Compile

Load File

Save As

Save

Check File out of Source Control

Check File in to Source Control

Load Source from Existing Object

Reload Object from Databasee

Create New PLSQL Object

Compile Dependencies

Tune the Current Statement using Slab Xpert Tuner

Change Active Session for This Window

Run

Set Parameters

Step Over

Trace Into

Trace Out

Run to Cursor

Halt

Add Watch

Compile Dependencies with Debug

The first shortcut is F2. This toggles on the error message panel. Figure 4.3 shows the Procedure Editor with error message panel toggled on. This is helpful when working on longer SQL statements or SQL scripts.

Figure 4.3. TOAD Procedure Editor window with error grid.

F2 Toggles Error Message Panel

F9 Compile

Ctrl+S Save

F11 Run

Shift+F9 Set Parameters

F8 Step Over

F7 Trace Into

Shift+F8 Trace Out

F12 Run to Cursor

Ctrl+F5 Add Watch

This editor has several parts. The main edit window enables you to edit multiple PL/SQL objects at a time. Each object will have its own tab along the top of this section. See the ST_CALC_PROFIT tab in Figure 4.3.

To the left of this section is the object navigator. This enables you to easily navigate to parts of the object, convenient for those code blocks with dozens or hundreds of lines of code.

The lower section is tabbed and enables you to set and see the breakpoints for the debugger, the debugger watches , the call stack (what objects have called other objects), and the DBMS_Output.

The F2 key toggles on/off the syntax error messages panel (see bottom of Figure 4.3). This panel automatically toggles on when you compile your code and you receive an error. F2 would then hide the panel.

[ic:keyboard] F2 toggles on/off error message line.

Figure 4.4 illustrates the Highlighting options in the Editor Options window. You can see that you have complete control over the editor environment (such as autoreplacement of words, general layout and text wrapping in the edit window, key assignments, and code templates).

Figure 4.4. TOAD Procedure Editor Options.

TOAD has three editors: the SQL Editor (covered in Chapter 3), the Procedure Editor, and a text editor of your choice. The editor environment applies its options to both TOAD editors. Additional editors can easily be added to TOAD. Choose View, Options from the menu bar, and then select Editors (or use the Configure TOAD Options button) to add your editor of choice. Figure 4.5 illustrates how to add the Notepad editor, for example. Be sure to use the variable %s to pass this editor the SQL that you are currently working on. If your current session has not been saved, you will be prompted to save it. Also, upon exiting your external editor, you will be prompted to reload your work from the saved file. You then use this external editor from the menu bar by choosing Edit, Load in External Editor or by using the shortcut Ctrl+F12. Figure 4.6 shows some work in the Notepad editor.

Figure 4.5. Defining external editors in TOAD.

Figure 4.6. Using Notepad as editor in TOAD.

Ctrl+F12 accesses a previously defined external editor.

There are several ways to get PL/SQL code into the Procedure Editor. You can simply type in a new SQL statement, or create a new work area for a new SQL or PL/SQL block using the Create New PLSQL Object button. You can load SQL or PL/SQL from a file using the Load File button. This button has a drop-down menu that contains the history of loads. You can also check out code from the source code using the Check File Out of Source Control button. You can also load the code from the database using the Load Source from Existing Object button. This button also has a drop-down menu that contains the history of selected objects. You can also load code with a cut-and-paste from other applications.

Figure 4.7 illustrates loading code from a file. Notice that the drop-down menu from the Load File button shows a history of files accessed by TOAD. Loading code from the database is just as easy using the Load Source from Existing Object button. It has a similar drop-down menu of a history of objects accessed by TOAD. You can also create new code from the default code template by using the Create New PLSQL Object button. Notice that TOAD easily handles multiple objects at the same time, giving each its own tab.

Figure 4.7. Loading code into the Procedure Editor.

TOAD will also easily format your PL/SQL into an easy-to-read format. Figure 4.8 shows how to access the formatter by right-clicking in the edit window and selecting Formatting Tools, Format Code from the context menu. Figure 4.9 shows how TOAD formats the SQL.

Figure 4.8. Accessing PL/SQL Formatter.

Figure 4.9. TOAD formatted PL/SQL.

This overview covered some of the basic concepts and features of the Procedure Editor. The remainder of this chapter will cover specific topics in the Procedure Editor.



TOAD Handbook
TOAD Handbook (2nd Edition)
ISBN: 0321649109
EAN: 2147483647
Year: 2003
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net