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 compliant 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 --Compliant 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;