Chapter 5 Building Triggers and Procedures


Creating Triggers for Referential Integrity

You can create triggers automatically for one or more tables in a model, when you specify that triggers are to be used to implement referential integrity and for columns where the values depend on a sequence.

Steps To implement referential integrity between tables by triggers:

  1. Create a reference between two tables, and then double click the reference symbol to open its property sheet.
  2. Click the Integrity tab, and then select Trigger from the Implementation list.
  3. Specify the form of Update and Delete constraints using the radio buttons, and then click OK to return to the diagram.
  4. If you have set the Automatically rebuild triggers model option, then triggers will have been created automatically in the parent and child tables. To verify this, double-click the table symbol to open its property sheet, and then click the Triggers tab. If the triggers are not present,, you will need to rebuild your triggers manually.

    For more information about the Automatically rebuild triggers model option and rebuilding triggers manually, see "Rebuilding Triggers".

    For more information about selecting referential integrity options from the Reference property sheet, see section Defining referential integrity in chapter Building Physical Diagrams.

You can instruct PowerDesigner to implement referential integrity between tables using triggers by default.

Steps To implement referential integrity between tables by triggers by default:

  1. Select Tools Model Options and click Reference under Model Settings in the Category list.
  2. Select Trigger from the Default implementation list, and then click OK.

    From now, when you create a reference between tables, referential integrity will be implemented using triggers by default.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.