User Guide : 6. Working with Databases : Using Rules : New Rule Dialog
 
Share this page                  
New Rule Dialog
You create new database rules using the New Rule dialog. This dialog contains the following fields and controls:
Name
Specifies the name of the rule. Names must follow Object Naming Rules and must be unique within the set of rules owned by the user creating the rule.
Table Name
Lets you select a table for which to create the rule. The table currently selected in the Instance Explorer is displayed by default.
Fire Rule
Specifies whether the rule should be executed before or after the effective execution of the triggering statement. If you select Before, For Each must be set to Row.
On Action
Specifies the type of statement that triggers execution of the rule. You can specify one or more of the following triggers:
Insert
Delete
Update (choose columns)
Columns
If you select the Update trigger, the Columns button becomes active. Clicking Columns opens the Columns dialog, where you must choose which table columns to include in the update.
Where Clause
Specifies the specific change that must occur to the table to fire the rule. The qualification must evaluate to true or false.
The qualification cannot include a subselect or an aggregate (set) function such as count or sum. You may include where clauses.
For Each
Defines whether the rule is row or statement level.
Row
When a row-level rule is executed, a parameter list is built and the procedure is invoked for each row touched by the statement. If a single DELETE or UPDATE statement affects 100 rows, the procedure invocation occurs 100 times.
Statement
When a statement-level rule is executed, the parameters passed in the procedure invocation for each qualifying row of the triggering statement are accumulated in an internal temporary table. The temporary table, containing information from all rows touched by the triggering statement, is passed with a single call to the rule procedure. This can potentially save many calls to the rule procedure.
All qualifying rows contained in an internal temporary table are processed by the triggering statement so that the rule procedure is invoked only once.
Default: Row
Execute Procedure
Lets you specify the procedure name and parameters
Procedure Name
Specifies the procedure to be executed when a statement executes the rule. The procedure must exist before the rule is created. For more information, see Create a Procedure.
Parameters
If the selected procedure contains parameters, the Parameters button becomes active. Clicking Parameters opens the Procedure Parameters dialog where you can set values for parameters by double-clicking the Value column and entering a value. Click Save to save parameter values.
OK
Saves the rule and closes the dialog
Cancel
Closes the dialog without saving any changes
For more information, see Create a Rule.