Chapter 17. Command Referencefor Adaptive Server Anywhere
CREATE TRIGGER statement
Function Usethis statement to create a new trigger in the database. Oneform of
triggeris designed specifically for use by SQL Remote.
Syntax CREATETRIGGER trigger-name trigger-time
trigger-event, .. .
[ORDER integer ]ONtable-name
[REFERENCING [OLDAS old-name]
[NEWAS new-name] ]
[REMOTEAS remote-name ] ]
[FOREACH {ROW |STATEMENT} ]
[WHEN (search-condition )]
[IFUPDATE (column-name )THEN
[{ AND |OR }UPDATE (column-name ) ] . .. ]
compound-statement
[ELSEIFUPDATE (column-name )THEN
[{ AND |OR }UPDATE (column-name ) ] . ..
compound-statement
ENDIF ]]
trigger-time:
BEFORE |AFTER |RESOLVE
trigger-event:
DELETE |INSERT|UPDATE
|UPDATEOF column-name [,column-name,...]
Parameters trigger-time Row-leveltriggers can be defined to execute BEFORE or
AFTERthe insert, update, or delete. Statement-leveltriggers execute
AFTERthe statement. TheRESOLVE trigger time is for use with
SQLRemote: itfires before row-level UPDATEor UPDATE OF
column-listsonly.
BEFOREUPDATE triggers fire any time an UPDATEoccurs on a row,
whetheror not the new value differs from the old value. AFTER UPDATE
triggersfire only if the new value is different from the old value.
Triggerevents Triggerscan be fired by one or more of the following
events:
DELETE Invokedwhenever a row of the associated table is deleted.
INSERT Invokedwhenever a new row is inserted into the table
associatedwith the trigger.
UPDATE Invokedwhenever a rowof the associated table is updated.
UPDATEOF column-list Invokedwhenever a row of the associated
tableis updated and a column in the

column-list

ismodified.
359