SQL Templates


TOAD can easily format a SELECT or INSERT statement for any data-oriented object (view or table). Simply place the cursor on the object you want and press F4. This will perform a describe on the object, as illustrated in Figure 4.23.

Figure 4.23. Object description.

Notice in Figure 4.23 that everything you need to know about the object appears in this window.

It is particularly nice to have TOAD build a script that created the object. This information comes from the data dictionary and accurately reflects the object that you are working with.


Most of this information is covered in other chapters. To get to the SQL templates, use the Columns tab and right-click on any of the column names . This brings up another menu of mostly administrative functions (most of these features are covered in other chapters), as shown in Figure 4.24. Notice where the cursor is (Generate Statement); you have the choice of building a SELECT or INSERT statement for this particular object. When making a selection, TOAD will tell you that the "script copied to the clipboard." Figure 4.25 shows the code in the TOAD Procedure Editor that was pasted from the clipboard.

Figure 4.24. TOAD Generate Statement selection.

Figure 4.25. Generated SQL statements.

F4 to describe the object

Right-click on a column in the Columns tab and select Generate Statement

You can also use the Show SQL Template Window button (third toolbar, rightmost button) to paste in specific SQL templates while doing PL/SQL coding. Figure 4.26 illustrates how to use these templates. Options include directly copying the template into the Procedure Editor (as illustrated in Figure 4.26) or copying the template to the clipboard. Notice that there are all kinds of SQL templates. TOAD contains templates for row, group , and date functions.

Figure 4.26. TOAD SQL templates in action.



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