This is part of a series of guest posts by Dan Hotka.
This week I want to show how Rapid SQL can improve your coding productivity and technique by using its templates. A template saves me from having to look up the exact syntax.
To use, simply put your cursor on your code where you want a template and use the key strokes CTRL + Space bar. This brings up the template popup window:
From here, we select the code we want using a double-click operation, in this example, I’d like a CASE statement and it dumps the code into your PL/SQL!
Now I can complete the code to my satisfaction.
To add your own templates, this is very similar to the blog I did on using Autoreplace (remember…to create your own coding shortcuts).
Go to Tools à Code Workbench then to the Code Templates tab.
Notice that you can export and import your settings between releases of Rapid SQL. This is convenient to preserve your code templates.
Notice here that we have the Embarcadero multi-database support showing up. IF you are just using SQL Server or just Oracle…you can easily delete the non-pertinent database options.
You can also add your own templates.
I’ve worked with a number of programming languages such as COBOL and C over the years. Most other languages have copy libraries, or chunks of code that is copied in at compile time. PL/SQL does not have this feature.
So…any chunks of code you wish to share across your PL/SQL routines, such as a standardized exception clause…simply add it here and include it with just a couple of key strokes and a mouse action!
The big difference between Auto Replace and Code Templates is Auto Replace is a one-line code snippet and is signaled from the space bar, where Code Templates can contain many lines of code and is signaled with the ctrl+space bar.
CTRL + Space Bar by itself brings up the entire list of options. You select one using a double click operation. As you get used to the short cut name, you can enter this and hit ctrl + space bar and this single code template will instantly load into your code.
What would I do? I’d customize these templates to my coding style and typical options I would have in my code. I’d add my own templates of code I commonly use. I would use templates for what would be copy libraries in other coding languages.
I hope this technique helps you in your day-to-day use of Rapid SQL.
Oracle ACE Director
Click here to earn more about Rapid SQL and try it free
Dan Hotka is a training Specialist and an Oracle ACE Director who has over 36 years in the computer industry, and over 30 years of experience with Oracle products. His experience with the Oracle RDBMS dates back to the Oracle V4.0 days. Dan enjoys sharing his knowledge of the Oracle RDBMS. Dan is well-published with12 Oracle books and well over 200 published articles. He is frequently published in Oracle trade journals, regularly blogs, and speaks at Oracle conferences and user groups around the world.