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

Save Statements (SQL Recall)

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.

 

Save and Reuse SQL Statements

Work with Code > Save Statements (SQL Recall) > Save and Reuse SQL Statements

Through SQL Recall, you can save any SQL statement to your Toad environment so that it can be reused. If statements are not saved, they are eventually discarded as new statements are executed and added to the list.

To view the SQL Recall pane

From the main Toad menu bar, select View | SQL Recall (F8).

  • Recently executed statements are stored on the Recent pane.
  • Saved statements are stored on the Saved panel of SQL Recall.

Statements can be saved in two ways:

  • Unnamed: When you save a statement without a name, it is saved to the Saved tab with a Toad-assigned name of Statement (n), where n is a number that increments by one for each new saved statement.
  • Named: The best way to save SQL statements is to save them as Named SQL. When a statement has a name, you can:

    • easily access it in the Editor.
    • easily determine what it does, rather than having to read through the code.

Statements are saved under categories. Categories enable you to organize your statements, for example by application or type of data. Toad provides a Default category which contains any statements not placed in a specific named category.

To save a statement without naming it

  1. In the Recent pane of SQL Recall, select the statement or statements that you want to save.
  2. Right click and then select Add to Saved.
  3. Select a category or specify a new one, and then click OK. The statement is saved to that category on the Saved tab.

To save a SQL statement as Named SQL

  1. Do one of the following, depending on where the statement is displayed:

    Editor: In the Toad toolbar, select Editor | Add to Saved SQLs.

    SQL Recall: If the statement is still in the Recent tab, click Add to Saved to move it to the Saved tab. Once a statement is on the Saved tab, right-click the statement, then select Properties.

  2. Select a category or specify a new one.
  3. Provide a name in the Name field. Note: The name is case sensitive. For example, you can save both sql1 and SQL1.
  4. Select a schema for the saved SQL.
  5. Select the database that contains the specified schema.
  6. Click OK.

To open a Named SQL statement in the Editor

  1. Select one of the following options:
    • Press CTRL+N in the Editor and select the statement from the pick list.
    • Enter MyNamedSQL in the Editor, where MyNamedSQL is the name of your saved SQL statement. Toad replaces the SQL name with the saved statement at execution.
    • Double-click or drag the statement from the SQL Recall pane.

Execute a saved SQL statement

Once a saved SQL statement (named or unnamed) is open in the Editor, you can:

  • Execute it from the Editor. Execute Single Statements
  • Execute it from the Connection Panel of the Project Manager. See the online help for more information about Project Manager.

Export or import a saved SQL statement

Toad allows you to export and import saved SQL. Import/Export Saved SQL.

 

Import/Export Saved SQL

Work with Code > Save Statements (SQL Recall) > Import/Export Saved SQL

You can export your saved SQL from SQL Recall for use by others, and you can import saved SQL into your own Toad environment.

You can export your recent statements, your saved statements, or both, or you can select specific categories or statements to export.

Note: This feature was introduced in Toad 11, and consequently you can only import these files with Toad 11 and later versions.

To export saved SQL

  1. Select View | SQL Recall (F8).
  2. If you want to export specific statements, select them.
  3. Click on the SQL Recall toolbar.

    Tip: You may need to expand the SQL Recall pane to see the button.

  4. Under Statements, select the types of statements to export*:

    All: export all statements from Recent and Saved tabs.

    Recent: export only the statements on the Recent tab.

    Saved: export only the statements on the Saved tab.

    Selected: export only the statements that you explicitly select.

  5. Under Format, select the output format:

    SQL Recall data file: Save as the file type used by Toad to store recent and saved statements.

    Single File: Save as a single text-based file.

    Individual Files: One file for each Saved category and one for all Recent statements: Save one file for each Saved category and save all Recent statements in one file. (Whether these outputs will be present depends on what you selected under Statements.)  If you select this option, select an extension under File Extension.

*Note: Recently executed statements are always stored in one file. Saved statements are stored either by category name or by a user-defined name, depending on how you specified the export.

To import saved SQL

  1. Click on the SQL Recall toolbar.

    Tip: You may need to expand the SQL Recall pane to see the button.

  2. Select the saved SQL export file.
  3. Select Append mode to add the imported SQL to your existing library of recent or saved statements, or select Replace to replace the existing library of recent or saved statements with the contents of the imported file. Important! A Replace cannot be undone, and your existing statements will be permanently overwritten by the imported ones, including any category names.
  4. Click OK.

 

Work with PL/SQL Objects

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.

 

Related Documents