Use the CREATE TRIGGER command to create a signal trigger that fires in response to incidents in the ObjectServer, or that fires in response to a user-defined signal.
CREATE [ OR REPLACE ] TRIGGER trigger_name
GROUP group_name
[ DEBUG { TRUE | FALSE } ]
[ ENABLED { TRUE | FALSE } ]
PRIORITY integer
[ COMMENT 'comment_string' ]
ON SIGNAL { system_signal_name | user_signal_name }
[ EVALUATE SELECT_cmd BIND AS variable_name ]
[ WHEN condition ]
[ DECLARE variable_declaration ]
BEGIN
trigger_action
END;
If there is a possibility that a trigger already exists with the same name as the one that you want to create, use the optional OR REPLACE keywords. If the trigger exists, it is replaced by the one that you are creating. If the trigger does not exist, a new one is created.
The trigger_name value must be unique within the ObjectServer and comply with the ObjectServer naming conventions.
The group_name value can be any trigger group already created by using the CREATE TRIGGER GROUP command.
If DEBUG is set to TRUE, debugging information is sent to the ObjectServer message log, if the message level is set to debug.
If ENABLED is set to TRUE, the trigger fires when the associated incident occurs. Otherwise, the trigger does not fire when the incident occurs.
The PRIORITY of a trigger determines the order in which the ObjectServer fires triggers when more than one trigger is associated with the same incident. The priority can be in the range of 1 to 20. The lower the number, the higher the priority, so a trigger with a priority of 2 is fired before a trigger with a priority of 3. If more than one trigger of the same priority is fired because of the same incident, the order in which these triggers fire is undetermined.
Use the optional COMMENT keyword to add a comment (comment_string) for the trigger.
The ON SIGNAL name can be the name of a system or user-defined signal that fires the trigger.
The optional EVALUATE clause enables you to build a temporary result set from a single SELECT statement to be processed in the trigger_action. The SELECT statement cannot contain an ORDER BY clause.
When a system or user-defined signal is raised, attributes that identify the cause of the signal are attached to the signal. These attributes are passed as implicit variables into the associated signal trigger.
Use the optional WHEN clause to test for a particular condition before the trigger action runs. If the condition is not met, the trigger action does not run.
You can optionally declare local trigger variables for use in the body of the trigger. These variables are declared and used in the same way as procedure variables. However, trigger variables are static, so they maintain their value between the times when the trigger runs.