Oracle updating trigger

21 Jan

Constraints are declaractions of conditions about the database that must remain true.

These include attributed-based, tuple-based, key, and referential integrity constraints.

And that’s when you remember that your table has a for each row after-update trigger that inserts into an audit table, synchronises a mirror table, performs some calculations, updates some other columns, and, probably, pauses to smoke a cigar too. To implement it you write an after-insert trigger on the SALES table. If, for whatever reason, your transaction is rolled back after you’ve inserted 100 rows into SALES, those rows will be erased – but what about the emails? It’s almost as if they’re the apple tree in the middle of Eden, a trap placed there to tempt us to sin. I use them to maintain modified by and modified date columns. So take off that I ♥ DATABASE TRIGGERS t-shirt; let’s set fire to it.

The issue I was highlighting is that because triggers fire automatically, they can sometimes seem like hidden anarchists lobbing Molotov cocktails into your code from the shadows.

Imagine you have a huge table – 1 million rows – and you need to update a column. If you have triggers on the table, not even Nostradamus knows how many records across the database were really updated. Triggers are also a convenient hiding place for bugs. Tom Kyte points out another reason to be wary of triggers. And it’s not just utl_mail; the same thing would happen with utl_file, utl_http, and many other utl_ functions.

The processing is to be done via a trigger so that we get a single, consistent, approach to detecting changed data from multiple client (vendor) software processing.

The table we shall process is the following: Jum, Thanks for the comments.