Home

Compound triggers should define at least two triggers

Rule description

  • Compound triggers should define at least two triggers

 

Non-compliant Code Example

CREATE TRIGGER trgCustomerAdded 
FOR INSERT 
ON CUSTOMERS
COMPOUND TRIGGER    --Non complaint code (Compound trigger with only one trigger)
BEFORE EACH ROW IS 
BEGIN
:new.minimunExpense:= 2000;
END BEFORE EACH ROW;
END trgCustomerAdded;

Compliant Code Example

CREATE TRIGGER trgCustomerAdded 
FOR INSERT 
ON CUSTOMERS
COMPOUND TRIGGER    --Complaint code (Compound trigger with more than one trigger)
BEFORE EACH ROW IS 

BEGIN
:new.minimunExpense:=2000;
END BEFORE EACH ROW;

AFTER EACH ROW IS
BEGIN
INSERT INTO CUSTOMERS VALUES('PQR',‘ABC’,3000,9328491037); 
COMMIT;
END AFTER EACH ROW;

END trgCustomerAdded;
Visual Expert 2020
 VEPLSQLRULE108