サポートと今すぐチャット
サポートとのチャット

Toad Data Studio 1.1 - User Guide

Add Toad Views

Toad Views give you a convenient way to save and reuse SQL queries. In addition to saving your queries in Toad like SQL Recall, Toad Views allow you to more-easily work with, customize, and organize your queries. Use Toad Views to save long and complex SQL to use as a starting point for querying. Or create your own "personal" database views to query against. This can be especially useful if you can't create your own views in the database itself. In addition, you can use Toad Views to save queries to reuse on different databases, such as on a development and a production database.

You can select a SQL query from the Editor, the Query Builder, or the SQL Recall pane and save it as a Toad View. The views are stored in Toad and accessed through the Toad Views manager. You can use the Toad Views manager to organize your views into folders, to create new views, and to modify current views.

For a video demonstration of this feature, please see Introduction to Toad Views.

To open the Toad Views manager

  • Select View | Toad Views.
  • Select a Toad View to display the view's SQL statement and the connection information.

To save SQL as a Toad View

  1. Do one of the following:

    • In the Editor, right-click the SQL statement you want to save and select Add to Toad Views.
    • In the Query Builder, right-click within the Diagram window and select Add to Toad Views.
    • In the SQL Recall pane, right-click a SQL statement and select Add to Toad Views.
  2. Enter a name for the Toad View.

    Note: To open the Toad Views manager after saving, select the Open Toad View Manger option.

To create a Toad View from the Toad Views manager

  1. Select View | Toad Views to open the Toad View manager.
  2. Right-click within the Toad View manager and select New Toad View.
  3. Rename the new view and press the Enter key to open an editor.
  4. Enter or paste SQL into the editor, or click to select a SQL file. Click to review the result set.

To use a Toad View

  • In the Toad Views Manager, do one of the following:
    • To add a Toad View to a Query Builder, drag the view to the Query Builder Diagram window.
    • To add a Toad View to the Editor, double-click the view.

      Note: If the active window is not an Editor, double-clicking a view in the Toad Views manager opens a new Editor window containing the view.

  • Unlike code snippets, the contents of a Toad View are not pasted into the Editor. The Toad View name (in curly brackets) is replaced with the view contents only during script execution. This allows you to update the Toad View any time without affecting the script in the Editor.

To use a Toad View in a cross-connection query (Query Builder)

  1. Drag an object (table or view) with the first connection to the Query Builder window.
  2. Now drag a Toad View containing the second connection to the Query Builder window. Toad asks you if you want to use the original connection. Click Yes. The window changes to Cross-Connection Query Mode.

    Note: Whenever you add a Toad View to a Query Builder in which the active connection does not match the view's original connection, Toad asks you if you want to use the view's original connection.

To use a Toad View containing a cross-connection query

  1. Do one of the following to use a Toad View containing a cross-connection query:
    • Query Builder: Drag a view containing a cross-connection query to the Query Builder.
    • Editor: Double-click a view containing a cross-connection query in the Toad Views manager with an empty Editor window active.
  2. The Query Builder or Editor window changes to Cross-Connection Query Mode.

Toad Views and bind variables

Toad Views are different than normal views in that Toad Views can contain bind variables. If you execute a Toad View that contains a bind variable, Toad will prompt you for a value.

Note: Toad allows you to store values for bind variables. Click in the Toad Views toolbar to open the Bind Variable dialog where you can manage your variable/value combinations. See Using Bind Variables for more information.

Important Considerations and Limitations When Using Toad Views

Consideration/Limitation Description
Using aliases in Toad Views If you use an alias name in a Toad View, you cannot use the same alias name in the parent query.
Toad Views containing functions

You could encounter an error if you use a Toad View containing a function in a cross-connection query.

 

Tips:

  • Click on a view in the Toad Views manager to see the SQL statement and connection information displayed in the bottom pane.
  • To display the result set for a Toad View, with an empty Editor window open, double-click the view in the Toad Views manager. The view is added to the Editor and the result set displays in the lower pane.
  • Use the Search feature to filter views in the Toad Views manager.
  • To add folders, right-click within the Toad Views manager and select New Folder.
  • You can drag and drop views between folders to reorganize them.
  • The Toad Views you create are available through code completion in the Editor.
  • Right-click a view and select Add to Project to add the view to the currently-open project in the Project Manager.
  • The format for a Toad View is the name of the view surrounded by two sets of curly brackets {{MyToadView}}.

  

Related Topics

 

関連ドキュメント

The document was helpful.

評価を選択

I easily found the information I needed.

評価を選択