Oracle triggers - problem with mutating tables

前端 未结 8 1845
情书的邮戳
情书的邮戳 2020-12-06 19:31

My tables:

TableA (id number, state number)
TableB (id number, tableAId number, state number)
TableC (id number, tableBId number, state number)
8条回答
  •  北海茫月
    2020-12-06 19:49

    You should imho not use triggers for complicated business logic. Move it to a stored proc (PL/SQL package) or the client code. Apps with a lot of triggers become unmaintanable beause you will loose any feeling of "sequence of actions" very soon.

    Using autonomous transactions is absolutely unsafe, use autonomous transaction only for logging, tracing, debugging and maybe auditing.

    Read: http://www.oracle.com/technetwork/issue-archive/2008/08-sep/o58asktom-101055.html

    Here you can read how you can solve the problem when you want to use triggers without using autonomous transactions: http://www.procaseconsulting.com/learning/papers/200004-mutating-table.pdf

提交回复
热议问题