Sybase Adaptive Server Anywhere Reference page 496

Table of Contents

Advertisement

CREATE TRIGGER statement
478
UPDATE OF column-list
table is updated and a column in the column-list has been modified.
trigger-time
Row-level triggers can be defined to execute BEFORE or
AFTER the insert, update, or delete. Statement-level triggers execute
AFTER the statement. The RESOLVE trigger time is for use with
SQL Remote: it fires before row-level UPDATE or UPDATE OF column-
lists only.
BEFORE UPDATE triggers fire any time an UPDATE occurs on a row,
whether or not the new value differs from the old value. AFTER UPDATE
triggers fire only if the new value is different from the old value.
FOR EACH clause
To declare a trigger as a row-level trigger, use the
FOR EACH ROW clause. To declare a trigger as a statement-level trigger,
you can either use a FOR EACH STATEMENT clause or omit the FOR
EACH clause. For clarity, it is recommended that you enter the FOR EACH
STATEMENT clause if declaring a statement-level trigger.
ORDER clause
Triggers of the same type (insert, update, or delete) that
fire at the same time (before, after, or resolve) can use the ORDER clause to
determine the order that the triggers are fired.
REFERENCING clause
NEW clauses allow you to refer to the deleted and inserted rows. For the
purposes of this clause, an UPDATE is treated as a delete followed by an
insert.
The REFERENCING REMOTE clause is for use with SQL Remote. It
allows you to refer to the values in the VERIFY clause of an UPDATE
statement. It should be used only with RESOLVE UPDATE or RESOLVE
UPDATE OF column-list triggers.
The meaning of REFERENCING OLD and REFERENCING NEW differs,
depending on whether the trigger is a row-level or a statement-level trigger.
For row-level triggers, the REFERENCING OLD clause allows you to refer
to the values in a row prior to an update or delete, and the REFERENCING
NEW clause allows you to refer to the inserted or updated values. The OLD
and NEW rows can be referenced in BEFORE and AFTER triggers. The
REFERENCING NEW clause allows you to modify the new row in a
BEFORE trigger before the insert or update operation takes place.
For statement-level triggers, the REFERENCING OLD and
REFERENCING NEW clauses refer to declared temporary tables holding
the old and new values of the rows. The default names for these tables are
deleted and inserted.
Invoked whenever a row of the associated
The REFERENCING OLD and REFERENCING

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?

Questions and answers

Table of Contents