Creating a Trigger from Scratch

You can create a trigger without basing it on a template. However, we recommend that you use a template as this will simplify reuse of your code and make your triggers more portable.

  1. Double-click a table symbol to open its property sheet, and then click the Triggers tab.
  2. Click the Add a Row tool to create a new trigger, and type a name and code.
  3. Click Apply to commit the creation of the new trigger, and then click the Properties tool to open its property sheet.
  4. Click the Definition tab.


  5. Enter the trigger definition code. You can add trigger template items, use PDM variables and macros and various other tools available from the toolbar (see SQL Editor Tools).

    The trigger will be marked as user-defined and will be excluded from most forms of rebuilding (see Rebuilding Triggers).

  6. You can also modify the trigger's other properties. For a full list of the properties available, see Trigger Properties.
  7. Click OK in each of the dialog boxes.
Note:

When using the PowerDesigner Eclipse plug-in, you can right-click a trigger in the Browser and select Edit in SQL Editor from the contextual menu to open it in the Eclipse SQL Editor. You can optionally connect to your database in order to obtain auto-completion for table names. The trigger definition is added as a .SQL file to the Generated SQL Files list in the Workspace Navigator.