Chatee ahora con Soporte
Chat con el soporte

Toad for Oracle 17.0 - 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

Create Make Code Templates

You can create your own Make Code Statement templates.

You can set options for these templates.

See Code Assist Options in the online help for more information.

To create a Make Code template

  1. From the Toad Options window, select Editor | Code Assist.
  2. In the Make Code area, click Add.
  3. Use the following variables to create your own language template:
    • %SqlVar% - this is the MakeCode variable entered in the Toad Options | Editor | Code Assist | MakeCodeVariable box. Using a variable here is optional.
    • %SqlLength% - This will be replaced by the number of characters in all selected SQL, on one or multiple lines.
    • %SqlText% - This is replaced by the first line of SQL you have selected.
    • %SqlTextNext% - This will be replaced by any subsequent lines of SQL you have selected. This is cumulative and includes ALL subsequent lines of SQL.

    Note: For the best output result, it is recommended that the %SqlTextNext% variable be included on a separate line. Use the left and right brace for comments.

    Remarks (such as template name) should be included in brackets.

  4. Click OK.

Examples:

Using the following SQL:

Select *

from

Employees

and using the following code templates, you will get the results below.

Template

Result

{C# Language Template}

string %SqlVar%& = "%SqlText% "  

                            + "%SqlTextNext% "    

string SQL

= "Select * "

+ "from "

+ "employees "

;

{C++ Language Template}

 

char %SqlVar%[%SqlLength%];  

strcpy(%SqlVar%,"%SqlText%");

strcat(%SqlVar%,"%SqlTextNext%");

char SQL[23];  

strcpy(SQL,"Select * ");

strcat(SQL,"from ");

strcat(SQL,"employees");

{ Java Language Template }

"%SqlText% "

+ "%SqlTextNext% "

"Select * "

+ "from "

+ "employees "

 

Use Code Snippets

You can create and reuse code snippets in the Editor.

Note: The file associated with these items is located in:

C:\Users\<user>\AppData\Roaming\Quest Software\Toad for Oracle\<version>\User Files\CodeSnippets.dat

To use Code Snippets

  1. From the View menu, select Code Snippets.
  2. Select a category of code from the box at the top of the window.
  3. Select the code from the list. You can do the following:
    • View a description of the code in the area below the code list
    • Double-click the code to insert it into the active editor tab
    • Drag and drop code into the editor

To Edit Code Snippets

  1. In the Toad Options window (View | Toad Options), select Code Snippets.
  2. In the Code Snippets list, select the category of snippets you want to edit and then click Edit.
  3. Select the snippet you want to edit, and click Edit.
  4. Edit the Oracle Function or the description and click OK.

To Add Code Snippets to an existing category

  1. In the Toad Options window (View | Toad Options), select Code Snippets.
  2. In the Code Snippets list, select the category of snippets and then click Edit.
  3. Click Add.
  4. Enter the code in the Oracle function box.
  5. Enter a description in the Description box.
  6. Click OK.

To Add Code Snippets to a new category.

  1. In the Toad Options window (View | Toad Options), select Code Snippets.
  2. In the Code Snippets list, click Add.
  3. Enter a category name in the Category box.
  4. Enter the code in the Oracle function box.
  5. Enter a description in the Description box.
  6. Click OK.

To highlight a snippet

  1. Place your code in the snippet you want to highlight.
  2. From the Editor menu, select Highlight Snippet (CTRL+H).

 

Use a Pick List to Complete Code

Note: There are additional shortcut keys you can use with Code Insight. See Code Insight Pick List Shortcuts in the online help for more information.

Use Query Templates

select *

from dba_tables

where owner = <ObjectOwner>

and table_name in <ObjectList>

Documentos relacionados

The document was helpful.

Seleccionar calificación

I easily found the information I needed.

Seleccionar calificación