Home > Articles > Data > Oracle

TOAD SQL Editor

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

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 description on the object, as illustrated in Figure 3.26.

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

TIP

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); see Figure 3.27. 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 3.28 shows the code in the TOAD SQL Editor that was pasted from the clipboard. Both the SELECT and the INSERT are illustrated.

Figure 3.26Figure 3.26Object description.


Figure 3.27Figure 3.27 TOAD Generate Statement selection.


Figure 3.28Figure 3.28Generated 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 SQL coding. Figure 3.29 illustrates how to use these templates. Options include directly copying the template into the SQL window (as illustrated in Figure 3.29) 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. Also included are templates for PL/SQL coding, which will be covered in detail in the next chapter.

Figure 3.29Figure 3.29 TOAD SQL templates in action.

  • + Share This
  • 🔖 Save To Your Account