DID you know that TOAD comes with a ton of code templates? These templates often have substitution variables as well.
CTRL+ Space bar signals ALL of the templates. You can type in a template name, such as ‘crloop’…and hit the CTRL + Space bar and signal just one template as well.
Figure 1
Notice the &&c1 syntax becomes the subsitution. This panel prompts for the items to plug in, and it remembers what you used the last time you used the wizard.
Figure 2
Here is the resulting code.
DID you know that you can add your own?
Click on Toad Options -> Editor -> Behavior then there is a button for Code Templates.
Figure 3
Figure 4
You can see ALL of the templates available.
Lets add one for DBMS_OUTPUT.Put_Line. Lets place the cursor where one would want to start typing as well.
The ‘|’ tells the template where to put the cursor.
Click Add then fill in the box…click OK (it does an Apply as well)…and OK on the Editor Behavior panel.
Figure 5
Let's try it out. Enter ‘pl’ and then ctrl+space bar…and it works!
Figure 6
Templates are useful for about any repetitive code you prefer. Think about putting your common exception clauses in templates. Of course you can edit any of the existing templates to be more useful for your Oracle coding style, etc.
Start the discussion at forums.toadworld.com