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

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

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 3

Figure 4

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

Figure 5

Let's try it out. Enter ‘pl’ and then ctrl+space bar…and it works!

Figure 6

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.

About the Author

Dan Hotka

Dan Hotka is an Author/Instructor/Expert/Oracle ACE Director Alumni who uses TOAD regularly in his web-based and on-line courses. He is well published with many books still available on Amazon or www.DanHotka.com. Dan is available for user groups and company educational events. He regularly speaks at user groups around the world. Check his website for course listings, references, and discount codes for his online courses based in Safari.

Start the discussion at forums.toadworld.com