Statement Templates

This section describes how to use templates to make your queries more flexible.

What is a statement template?

A statement template is one or more SQL statement which contains placeholders which are replaced at execution time by the template parameters. The placeholders have the format $param and a number. The number is the number of the parameter after the template name. The first parameter has the name $param1, the second one $param2 and so on.

It's possible to use a template inside of another template but there is no check to avoid endless loops.

The plugin uses the Velocity engine to create the statements from the template. More about Velocity can be found under

Creating Templates

You can create a new template by using the context menu action 'Save as Template...' of the query text field or by using the template panel in the settings dialog.

Using Templates

To use a template you have to start your query with '@' followed by the template name and the template parameters.


@<template name>[ <parameter>(, <parameter>)*]