How to write a generalized trigger for a set of tables?

Advertisements

My aim is to create triggers to few tables upon updation or deletion of entries from these tables.
The trigger should enter the name and columns of the corresponding updated/deleted table to another user table.
Instead of writing individual triggers for each table is it possible to write a single trigger ?

>Solution :

Instead of writing individual triggers for each table is it possible to write a single trigger?

[TL;DR] No


The CREATE TRIGGER syntax is:

Syntax

create_trigger ::=

plsql_trigger_source ::=

simple_dml_trigger ::=

dml_event_clause ::=

As you can see from the syntax diagram, a CREATE TRIGGER for simple DML will be in the format:

CREATE TRIGGER trigger_name
  AFTER UPDATE OR DELETE ON table_name

The syntax requires a single table/view identifier to be specified for each trigger.

Leave a ReplyCancel reply