7.4. Processing Row Captured Data

Row triggers can store :OLD and :NEW column values in a global temporary table. The scope of a global temporary table is just that transaction. By copying :OLD and :NEW values, the processing of the business rule can be deferred to the statement level trigger. Sometimes this is necessary because the business rule is complex and requires queries from tables, including the table being updated.

The following illustrates the general technique. First a global temporary table is needed. This table will be used to store data in the row level trigger.

 CREATE global temporary TABLE professors_g (prof_name VARCHAR2(10), specialty VARCHAR2(20), hire_date DATE, salary NUMBER(7,2), tenure VARCHAR2(3), department VARCHAR2(10)) ...

Get Programming Oracle® Triggers and Stored Procedures, Third 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.