rules repository

G-7730 – Avoid multiple DML events per trigger.

Rather than a single trigger handling multiple DML events with separated blocks of `if inserting`, `if updating` and `if deleting`, modularity by individual triggers per DML event helps maintaining and testing the code. If most of the code is common for either DML event (only small pieces of code are individual) consider an exception to the rule and allow `if inserting`, `if updating` and `if deleting` blocks, or alternatively gather the common code in a procedure and let individual triggers handle the individual pieces of code plus call the procedure with the common code. If the trigger makes assignment to a primary key and there are child tables with a foreign key referring to this primary key, the database can make undesirable table locks. If such is the case, you should always use individual triggers. See [G-7740](https://dblinter-rules.united-codes.com/rules/G-7740/) for details.

Tags: Stored Object, Performance.

Quality area: Reliability. Severity: Minor. Fixing time: Local-high.

No rule selected