Designing and Using Triggers
A trigger is essentially a special type of stored procedure that can be executed in response to one of three conditions:
UPDATE
INSERT
DELETE
The Transact-SQL syntax to create a trigger looks like this: |
CREATE TRIGGER TRIGGER_NAME
ON TABLE_NAME
FOR {INSERT, UPDATE, DELETE}
AS SQL_STATEMENTS
The Oracle SQL syntax used to create a trigger follows: |
CREATE [OR REPLACE] TRIGGER [SCHEMA.]TRIGGER_NAME {BEFORE | AFTER | INSTEAD OF} {DELETE | INSERT | UPDATE [OF COLUMN[, COLUMN]...]} [OR {DELETE | INSERT | UPDATE [OF COLUMN ...
Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.