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

Write Statements and Scripts

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.

 

Use the Code Navigator

  • Save the current file
  • Click the Refresh button.

Use the Object Palette

Work with Code > Write Statements and Scripts > Use the Object Palette

The Object Palette shows all of the objects and their columns in a selected schema. The Object Palette can be docked to the main Toad window, so that it is available within any of your Toad windows, or you can drag it away from its default location to use as a floating palette in a position of your choosing.

When you work in the Editor, you can use the Object Palette as a quick-reference tool to view the objects that you might want to use as you write SQL, rather than opening the Schema Browser for that purpose. You can also drag a table or column name from the Object Palette to Editor.

When the active connection changes the Object Palette automatically refreshes to reflect the new active connection. Or, you can use the refresh button to refresh the list (this method queries the database).

To access the Object Palette

From the View menu, select Object Palette.

To undock and redock the Object Palette

To undock and float the palette to a new location, drag the heading area to the desired position.

To redock the palette, double click the heading area.

To view columns

In the Object Palette, click . Columns are displayed for the selected object at the bottom of the palette.

To view objects from a different schema

  1. At the top of the Object Palette, click the Schema drop-down.
  2. Select the new schema from the list. Objects from that schema now display in the object list.

To change the style in which objects are listed

  1. Click the drop down arrow beside .
  2. Select the style in which you want to view objects.

To insert an object into an Editor

  1. Place your cursor in the Editor in the location where you want the object.
  2. In the Object Palette, double-click the object you want to insert.

To perform a DESCRIBE on an object

  1. In the Object Palette, select the object you want to describe.
  2. Press F4 to display the DESCRIBE window.

To filter the Object Palette

  1. In the Object Palette toolbar, click the appropriate filter button:
  2. Enter the filter criteria to limit the objects shown.

 

Use Code Completion Templates

Work with Code > Write Statements and Scripts > Use Code Completion Templates

Code Completion Templates enable you to store sections of code as a template and then use a keystroke (CTRL+SPACE) to select the named template from a list, which inserts it where your cursor is in the Editor. This feature reduces the amount of time that you spend writing the same code over again.

Code templates are more than a single phrase and can contain line feeds, substitution variables and a cursor position indicator.

Example

entire cursor block (crbl)

DECLARE

CURSOR c1 IS

SELECT | FROM WHERE;

c1rec IS c1%ROWTYPE;

BEGIN

OPEN c1;

LOOP

FETCH c1 INTO c1rec;

EXIT WHEN c1%NOTFOUND;

END LOOP;

CLOSE c1;

END;

Where:

  • crbl is the name of the template
  • entire cursor block is the description of the template
  • subsequent content is the body of the template

Note: Do not leave spaces between the end of the template description and the final right bracket! NT4.0 API calls to manage profile strings have a bug that will cause reading of the templates file to fail.

To edit or create a Code Template

Toad provides a list of default templates. As you use this feature, however, you can create templates that work better for your purposes, and you may want to edit the default templates or create new ones. You can view and manage Code Templates from the Editor section of the Toad Options. See Code Templates Options in the online help for more information..

To use a Code Completion Template

  1. Place the cursor where you want the template code to be inserted in the Editor.
  2. Type the name of the template (for example crbl) and then press CTRL+SPACE to load the body of the template. If you do not know the name of the template, press CTRL+SPACE to select it from a list. This list is also shown if you type a name that does not exist.

  3. When a template containing substitution variables is selected, you are prompted to enter values. Enter the values in the dialog, then press OK.

If Toad finds a single pipe ( | ) in the template body, it repositions the cursor at that point when the substitution of the template is complete. The pipe is removed, as it is used only as a marker for the cursor position. Only one pipe can be used this way in a code template.

 

Related Documents