CREATE TRIGGER

Create a trigger.

Syntax:

   CREATE [OR REPLACE] TRIGGER [schema.]trigger
      {BEFORE event | AFTER event | INSTEAD OF event}
         referencing_clause WHEN (condition) pl_sql_block

event can be one or more of the following (separate multiple events with OR)

   DELETE event_ref
   INSERT event_ref
   UPDATE event_ref
   UPDATE OF column, column... event_ref
   ddl_statement ON [schema.] {table|view}
   ddl_statement ON DATABASE
   SERVERERROR
   LOGON
   LOGOFF 
   STARTUP
   SHUTDOWN

event_ref:
   ON [schema.]table
   ON [schema.]view
   ON [NESTED TABLE nested_table_column OF] [schema.]view
referencing_clause:
   FOR EACH ROW 
   REFERENCING OLD [AS] old [FOR EACH ROW]
   REFERENCING NEW [AS] new [FOR EACH ROW]
   REFERENCING PARENT [AS] parent [FOR EACH ROW]

Multiple OLD, NEW and PARENT correlation names can be defined in one REFERENCING clause.

"A friend told me to shoot first and ask questions later. I was going to ask him why, but I had to shoot him" - John Wayne

Related Commands:

ALTER TRIGGER
DROP TRIGGER
ALTER TABLE

Related Views:

 DBA_TRIGGERS           ALL_TRIGGERS           USER_TRIGGERS 
 DBA_TRIGGER_COLS       ALL_TRIGGER_COLS       USER_TRIGGER_COLS
 DBA_INTERNAL_TRIGGERS  ALL_INTERNAL_TRIGGERS  USER_INTERNAL_TRIGGERS         




Back to the Top

Simon Sheppard
SS64.com