Oracle triggers if updating performance updating x cong file
Before Oracle7, only primary, unique, check and unenforced foreign keys were implemented.
The other constraints were typically validated in the client.
This problem can of course be slightly alleviated by proper coding and documentation, but it will never be straightforward.
Most developers tend to forget they are writing code that has to work in a multi user environment, especially when coding database triggers. For example, let's take a typical overlap business rule stating that periods, defined by the columns startdate and enddate, shall not overlap with other periods in the same table.
And above all, I agreed with virtually every opinion of Tom on several subjects. I concluded I had met the first topic on which we disagreed.
But to my big surprise, he seemed to dislike database triggers. His arguments against database triggers are roughly:1) they make things happen "automagically"2) they are rarely implemented correct3) they slow down DMLAt the time, I could understand the first point, but the second and third one didn't drive home with me.
contracts_pkg.array_contracts.count 5 loop 6 contracts_pkg.check_contract_ending_allowed 7 ( contracts_pkg.array_contracts(i)8 , contracts_pkg.array_contracts(i).customer_id 9 ); 10 end loop; 11 end; 12 /Trigger is [email protected] select * from contracts_trigger_approach where customer_id in (617,618) 2 / ID CUSTOMER_ID STARTDATE ENDDATE---------- ----------- ------------------- ------------------- 1233 617 1234 617 1235 618 1236 618 4 rijen zijn [email protected] update contracts_trigger_approach 2 set enddate = sysdate 3 where id = 1236 4 /update contracts_trigger_approach *FOUT in regel 1:. CONTRACTS_ASU", regel 4ORA-04088: Fout bij uitvoering van trigger 'RWIJK.The alternative, as Tom has often mentioned, is an api. In other words, just a package containing all actions that can be done to the entity.For each action all necessary checks are performed.And, what's the alternative when you want to implement business rules, but don't want to use database triggers?About two years ago, during and just after Tom gave a three day seminar in my home city, it all suddenly made sense to me.
If I opened two SQL*Plus sessions and inserted a period in session1, not committing yet, then switch to session2 and inserted the same period, they would both not see each others data and be not overlapping.