Skip to Main Content
Oracle in a Nutshell
book

Oracle in a Nutshell

by Rick Greenwald, David C. Kreines
December 2002
Intermediate to advanced content levelIntermediate to advanced
928 pages
85h 29m
English
O'Reilly Media, Inc.
Content preview from Oracle in a Nutshell

CREATE TRIGGER

CREATE [OR REPLACE] TRIGGER trigger_name
        {BEFORE | AFTER | INSTEAD OF} trigger_event 
ON 
   [ NESTED TABLE nested_table_column OF view ]    
      | table_or_view_reference | DATABASE [referencing_clause]
[FOR EACH ROW [WHEN trigger_condition]]
trigger_body;

Creates a trigger. The trigger body included in the CREATE TRIGGER statement is a standard PL/SQL block.

Keywords

BEFORE | AFTER

Triggers can fire BEFORE or AFTER the triggering event. AFTER data triggers are slightly more efficient than BEFORE triggers.

INSTEAD OF

Typically used with views, to allow updating of underlying tables for views through an INSERT, UPDATE, or DELETE statement.

trigger_event

One of the following events:

INSERT

Fires whenever a row is added to the table_or_view_reference.

UPDATE

Fires whenever an UPDATE changes the table_or_view_reference. UPDATE triggers can additionally specify an OF clause to restrict firing to updates OF certain columns.

DELETE

Fires whenever a row is deleted from the table_or_view_reference. Does not fire on a TRUNCATE of the table.

CREATE

Fires whenever a CREATE statement adds a new object to the database. In this context, objects are things like tables or packages (found in ALL_OBJECTS). Can apply to a single schema or the entire database.

ALTER

Fires whenever an ALTER statement changes a database object. In this context, objects are things like tables or packages (found in ALL_OBJECTS). Can apply to single schema or the entire database.

DROP

Fires whenever a DROP statement removes an object from ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle Internals

Oracle Internals

Donald K. Burleson
Oracle PL/SQL

Oracle PL/SQL

Lewis Cunningham
Oracle Essentials: Oracle9i, Oracle8i and Oracle8, Second Edition

Oracle Essentials: Oracle9i, Oracle8i and Oracle8, Second Edition

Rick Greenwald, Robert Stackowiak, Jonathan Stern

Publisher Resources

ISBN: 0596003366Errata Page