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 mentioned above.

  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 OK.

  5. Choose one of the following contexts from the Context drop-down menu:

    • 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-ASA Watcomif the template is to be used for only ASA Watcom SQL code.

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

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

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

  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