HiveBrain v1.2.0
Get Started
← Back to all entries
patternModerate

Alternatives to an INSERT Trigger

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
alternativestriggerinsert

Problem

Looking for an example code in Oracle to do the same. i.e.

Remove an insert trigger on table T1 whose job is to create a row in T2 based on the derived data. How would this PL-SQL api look like?

What would I loose in the real world app by replacing an Insert trigger?

More clarification based on the responses below:
We do not want Remote client to write to both table T1 and T2. This is a high throughput data and performance will suffer. Hence Remote client would write only to T1. Transfer from T1 to T2 should happen locally.

Solution

If T2 is derived data based on the contents of T1, then you may want to replace T2 with a materialized view. If T2 is rarely accessed, and quick to derive, then you may just want to use a view.

On the application side, if you stop maintaining table T2, then the values it gets will become increasing incorrect. This can be partially corrected by recalculating the derived values and updating T2 with the new values.

Context

StackExchange Database Administrators Q#1146, answer score: 10

Revisions (0)

No revisions yet.