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 a Toad View to display the view's SQL statement and the connection information.
To save SQL as a Toad View
Do one of the following:
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
To use a Toad View
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)
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
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.
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:
© ALL RIGHTS RESERVED. Conditions d’utilisation Confidentialité Cookie Preference Center