EasyManua.ls Logo

Sybase Adaptive Server Anywhere - CREATE TRIGGER Statement

Sybase Adaptive Server Anywhere
1182 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 9 SQL Statements
477
CREATE TRIGGER statement
Use this statement to create a new trigger in a database.
CREATE TRIGGER
trigger-name
trigger-time
trigger-event
[,
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
) ]
compound-statement
trigger-time:
BEFORE | AFTER | RESOLVE
trigger-event:
DELETE | INSERT | UPDATE | UPDATE OF
column-list
Must have RESOURCE authority and have ALTER permissions on the table,
or must be the owner of the table or have DBA authority. CREATE
TRIGGER puts a table lock on the table, and thus requires exclusive use of
the table.
Automatic commit.
"BEGIN statement" on page 404
"CREATE PROCEDURE statement" on page 453
"CREATE TRIGGER statement" on page 480
"DROP statement" on page 505
"Using Procedures, Triggers, and Batches" on page 435 of the book ASA
User’s Guide
The CREATE TRIGGER statement creates a trigger associated with a table
in the database, and stores the trigger in the database.
The trigger is declared as either a row-level trigger, in which case it
executes before or after each row is modified, or as a statement-level
trigger, in which case it executes after the entire triggering statement is
completed.
Trigger events Triggers can be fired by one or more of the following
events:
DELETE Invoked whenever a row of the associated table is deleted.
INSERT Invoked whenever a new row is inserted into the table
associated with the trigger.
UPDATE Invoked whenever a row of the associated table is updated.
Function
Syntax
Permissions
Side effects
See also
Description
Parameters

Table of Contents

Related product manuals