Home

DML events clauses should not include multiple OF clauses

Description

    The rule "DML events clauses should not include multiple OF clauses" states that when using Data Manipulation Language (DML) events, only one OF clause should be used. This means that when writing DML events, the syntax should only include one OF clause. Multiple OF clauses can lead to syntax errors and unexpected results, so it is important to adhere to this rule when writing DML events.

Key Benefits

  • Simplicity: DML events clauses should not include multiple OF clauses, which simplifies the syntax and reduces the chance of errors.
  • Consistency: The rule ensures that all DML events clauses are written in the same format, making them easier to read and understand.
  • Accuracy: By limiting the number of OF clauses, the rule helps to ensure that the intended action is taken, reducing the risk of errors.

 

Non-compliant Code Example

CREATE TRIGGER trgCustomerAdded 
FOR INSERT OF FIRSTNAME OR INSERT OF LASTNAME       --Non compliant code (DML events having multiple OF clauses)
ON CUSTOMERS

BEGIN
:new.minimunExpense:= 1800;

END trgCustomerAdded;

Compliant Code Example

CREATE TRIGGER trgCustomerAdded 
FOR INSERT OF FIRSTNAME, LASTNAME       --Compliant code
ON CUSTOMERS

BEGIN
:new.minimunExpense:= 1800;

END trgCustomerAdded;
Visual Expert 2024
 VEPLSQLRULE54