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.
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.
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.
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.
Let's try it out. Enter ‘pl’ and then ctrl+space bar…and it works!
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.