Chapter 5 Building Triggers and Procedures
Creating a trigger template item
You usually create a template item when an existing template item is not suitable, or to create a repeatable block of code to do updating work on tables in the database.
You can create a new trigger template in your DBMS definition file or as part of your model. You can begin by copying an existing template or write one from scratch.
To create a trigger template item:
- To create a DBMS trigger template item: select Database→Edit Current DBMS to open the DBMS definition file in the resource editor, and then click the Trigger Template Items tab:
or
To create a model trigger template item: select Model→Triggers→Trigger Template Items to open the List of User-Defined Trigger Template Items:
- Click on one of the following tools:
- Create from DBMS trigger item – opens a selection box listing all the trigger template items available in the current DBMS. Select a check box for the type of item that you want to use as the basis for your new item and click OK to return to the trigger template item list. The duplicate DBMS template item has been added to the list.
- Add a Row – adds a new blank template item to the list.
- Type a new name and code for the new template item and click Apply to commit its creation.
- Click the Properties tool to open the property sheet of the new template item:
- Click the Definition tab and enter or modify the definition code. You can use PDM variables and macros and various other tools available from the toolbar. For more information, see "Using the Definition tab toolbar".
- You can also modify other of the trigger template item's properties. For a full list of the properties available, see "Trigger template item properties".
- Click OK in each of the dialog boxes.
If you have created DBMS trigger template item, a confirmation box will appear, asking if you want to save the changes to the DBMS.
Click Yes to confirm the template creation.
Copyright (C) 2005. Sybase Inc. All rights reserved.
|
|