Contents Index CREATE SUBSCRIPTION statement DROP PUBLICATION statement

SQL Remote User's Guide
  Command Reference for Adaptive Server Anywhere

CREATE TRIGGER statement


Function 

Use this statement to create a new trigger in the database. One form of trigger is designed specifically for use by SQL Remote.

Syntax 

CREATE TRIGGER trigger-name trigger-time
trigger-event, ...
ORDER integer ] ON table-name
REFERENCING [ OLD AS old-name ]
   [ NEW AS new-name ] ]
   [ REMOTE AS remote-name ] ]
FOR EACH { ROW | STATEMENT } ]
WHEN ( search-condition ) ]
IF UPDATE ( column-name ) THEN
[ { AND | OR } UPDATE ( column-name ) ] ... ]
   compound-statement
ELSEIF UPDATE ( column-name ) THEN
[ { AND | OR } UPDATE ( column-name ) ] ...
    compound-statement
END IF ] ]

trigger-time:
BEFORE | AFTER | RESOLVE

trigger-event:
DELETE | INSERT | UPDATE
UPDATE OF column-name [, column-name, ...]

Parameters 

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.

Trigger events    Triggers can be fired by one or more of the following events:

Usage 

Anywhere.

Permissions 

Must have RESOURCE authority and have ALTER permissions on the table, or must have DBA authority. CREATE TRIGGER puts a table lock on the table and thus requires exclusive use of the table.

Side effects 

Automatic commit.

See also 

CREATE TRIGGER statement [SQL Remote]

UPDATE statement


Contents Index CREATE SUBSCRIPTION statement DROP PUBLICATION statement