Writing Your Own Templates

In addition to using predefined templates to enter SQL code, you can also create your own templates:

  1. Select Window|Preferences from the Eclipse menu. The Preferences dialog appears.

  2. From the left pane, select Sybase, Inc. and expand Database Development. Expand SQL Editor and choose templates to display a list of templates in the right pane.

  3. Click New. The New Template dialog appears.

    Note

    Alternatively, you can highlight a block of SQL statements in the SQL Editor, right-click, and select Save As Template to invoke the New Template dialog.

  4. In the Name field, enter a name for the template. The name is used for selecting templates from the content assist options list. Duplicate template names are allowed. Use the description or context to distinguish duplicate template names.

  5. From the Context drop-down menu, choose:

    • SQL if the template is to be used for all SQL code

    • SQL-ASA if the template is to be used only for ASA SQL code

    • SQL-ASE if the template is to be used only for ASE SQL code

    • SQL-ASIQ if the template is to be used only for ASIQ SQL code

    • SQL-ASE15 if the template is to be used only for ASE 15 SQL code

    • Replication Server if the template is to be used only for Replication Server SQL code

  6. In the Description field, enter an optional description of the template.

    The description displays after the template name in content assist.

  7. In the Pattern field, enter the template text pattern. The pattern can include predefined and custom template variables. Click OK.

Variables are placeholders that allow you to enter different values each time you apply the template. Before a template is inserted into SQL Editor, variables in its pattern are evaluated, and its placeholders are replaced with evaluated values. Variables are of the form ${variable_name}.

To insert variables into your template:

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com