A substitution is a text phrase that corresponds to replacement text. For example:
- If you specify a substitution pair of ACT = ACTIVITY_CENTERS, when you type ACT and press space (or other word delimiters), ACT is automatically replaced by ACTIVITY_CENTERS
- If you specify a substitution pair of NDF = NO_DATA_FOUND and you type NDF and press a delimiter, NDF is automatically replaced by NO_DATA_FOUND
Auto Replace Substitutions are different from aliases in that you can use any group of characters to define and complete the replacement. Aliases do not change the text in the SQL. They are a method of referring to a table by a different name. Substitutions will actually change the text within your code to match the target keystrokes.
To edit Auto Replace entries
- From the View menu, select View | Toad Options | Editor | Auto Replace.
- Make changes in the Auto Replace grid.
When auto-replace is active, Toad uses several characters as auto replace activation keys. Toad will automatically replace an activation key with the substitution value when it reaches a terminator, for example the space key. For example, if you type teh, Toad replaces it with the word the in the Editor. Or, you can enter the word pack and Toad will expand it to package.
An activation key will cause a matched replacement string immediately before the cursor to be replaced by the substitution value. For example, if you have dept = DEPARTMENT in your auto replace file, you can enter the following:
- dept[space] and the Editor will expand to DEPARTMENT .
- dept: and the Editor will expand to DEPARTMENT:.
- dept; and the Editor will expand to DEPARTMENT;.
Note: The activation key is always included in the expanded substitution.
You can edit this list of keys in the box if you have other needs.
Also from the Editing options window, you can import and export auto substitution files.
Toad comes with a handful of substitution pairs. You can edit and add to the list from the Auto Replace dialog. You can then export the settings to a text file. Alternately, you can create or edit a substitutions file manually and then import it.
Export: Saves the auto replace settings to a separate text file. If you make many changes to your auto replace settings, it is recommended that you export them regularly for back up.
Note: If you do not export your settings to a file before you import a file, they will be lost.
Import: You can import a text file into Toad. This file can be created independently or by exporting the settings you have created in Toad.
Importing a file overwrites the current settings.
Because it can be tedious to add large amounts of information to the substitution file directly from the interface, you may want to edit or create a text file directly.
Use the format of string=replacement string. For example: