(B)0[m[4mDEFINE[m [4mTRIGGER[m q> name wqqqqqqqqqqqqqq>qqqqqqqqqqqqqwwq> [4mBEFORE[m wk m> [4mDESCRIPTION[m IS /* text */ jmq> [4mAFTER[m qjx lqqqqqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj mw> [4mSTORE[m qqqqqqqqqqqqqqqqqqq>qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwk t> [4mERASE[m qqqqqqqqqqqqqqqqqqq>qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqux m> [4mMODIFY[m wqqqqqqqqqq>qqqqqqqqqqwwqqqqqqqqqqqqqq>qqqqqqqqqqqqwqjx m> [4mOF[m qw> field-name wjm> context-variable-clause qj x mqqqqq , <qqqqj x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqj m> [4mFOR[m context-var [4mIN[m relation-name w> triggered-action-clause w> . mqqqqqqqqqqqqqq<qqqqqqqqqqqj
1 – name
The name of the trigger that you can refer to in other statements. Use a name that is unique among all trigger names.
2 – text
A text string that adds a comment to the trigger definition.
3 – field-name
The name of a field within the specified relation to be checked for modification. You can specify a list of field names separated by commas. You can also specify all the fields in a relation by specifying the asterisk (*) wildcard character. Be sure that you specify ONLY those fields whose data values are to be changed. See the subtopic More for more information.
3.1 – More
In a BEFORE MODIFY or AFTER MODIFY trigger, be sure that you specify only the names of fields whose data values are to be changed, to avoid potentially unnecessary actions such as: o Overlaying the data with itself within a record. o Writing to the database (even though none of the fields in the record has actually changed values) o Evaluating constraints that apply to fields in the MODIFY field list which have not changed values o Evaluating MODIFY triggers that apply to fields in the MODIFY field list that have not changed values. o Evaluating RDO VALID IF clauses for fields in the MODIFY field list that have not changed values. If there is a possibility that any of the fields in a MODIFY field list will not actually be changed, the triggered actions for any pertinent MODIFY triggers should be changed accordingly. For those cases in which a triggered action performs an operation based on the changed value for a particular field, the action should include a conditional expression that prevents execution of the operation if no value change occurs. The conditional expression, which compares the old value with the new value, should appear as part of the triggered action's WITH clause.
4 – context-var-clause
(B)0[mcontext-variable-clause = qqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwq> tq> [4mOLD[m CONTEXT old-context-var qu mq> [4mNEW[m CONTEXT new-context-var qj An optional clause that can contain aliases for old and new states of the context variable of the triggering statement.
4.1 – old-context-var
A temporary name used to refer to the record values as they existed before a modify operation occurred. You use an old- context-var only when the trigger occurs after a modify operation, and must be a different name than the one given for context_var.
4.2 – new-context-var
A temporary name used to reference the new record values about to be applied by modify operation. You use a new-context-var only when the trigger occurs before a modify operation, and must be a different name than the one given for context-var.
5 – context-var
A temporary name defining the relation on which the trigger is defined. The context variable name is an alias for the record stream context of the triggering statement which has caused this trigger to be executed.
6 – relation-name
The name of the relation for which this trigger is defined (subject relation).
7 – triggered-action-clause
(B)0[mtriggered-action-clause = qwqqqqqqqqqqqq>qqqqqqqqqqqqqqwqk mq> [4mWITH[m conditional-expr qqj x lqqqqqqqqqqqqq<qqqqqqqqqqqqqqqj mq> [4mEXECUTE[m qw> triggered-statement qwqqwqqqqqqqqqq>qqqqqqqqwq> mqqqqqqqqqqq ; qqqq<qqqqj mq> [4mFOR[m [4mEACH[m [4mRECORD[m j (B)0[mtriggered-statement = qwq> store-statement qqqqqqqqqqqqqqqqqqqwq> tq> [4mFOR[m rse store-statement [4mEND_FOR[m qqu tq> [4mFOR[m rse erase-statement [4mEND_FOR[m qqu tq> [4mFOR[m rse modify-statement [4mEND_FOR[m qqu mq> [4mERROR[m qqqqqqqqqqqqqqqqqqqqqqqqqqqqqj A triggered action clause consists of a conditional expression (optional), one or more triggered statements, and a frequency clause (FOR EACH RECORD). The EXECUTE keyword precedes the triggered action clause.
7.1 – rse
A record selection expression that defines which records of which relations will be affected by the triggered update action. This rse cannot refer to any host variables.
7.2 – store-statement
A STORE statement to be initiated by the trigger.
7.3 – erase-statement
An ERASE statement to be initiated by the trigger.
7.4 – modify-statement
A MODIFY statement to be initiated by the trigger.
7.5 – WITH
A conditional expression that describes the optional condition that must be satisfied before the associated triggered statements are executed. This expression cannot refer to any host variables. For more information on Oracle Rdb conditional expressions, ask for HELP on the top level topic Cond_expr.
7.6 – FOR_EACH_RECORD
A frequency clause, FOR EACH RECORD (no underscores), determines whether an action is evaluated once per triggering statement, or for each record of the subject relation updated by the triggering statement. If the FOR EACH RECORD clause is not specified, the triggered action is evaluated only once, and record values are not available to the triggered action.