Cascading Triggers Assignment Help

Assignment Help: >> Triggers - Cascading Triggers

Cascading Triggers:

Triggers are said to be cascading when the body of the trigger causes another trigger to be fired. Let consider an example like that whenever a product is deleted in the product table the corresponding record in the ordprd table must be deleted. The subsequent trigger is created for the ordprd table:

CREATE OR REPLACE TRIGGER ORDPRDDEL AFTER DELETE ON ORDPRD

DECLARE

X NUMBER:=0;

BEGIN

SELECT COUNT(*) INTO X FROM ORDPRD; DBMS_OUTPUT.PUT_LINE('RECORD DELETED');

DBMS_OUTPUT.PUT_LINE('RECORDS AVAILABLE ARE '||X);

END;

/ CREATE OR REPLACE TRIGGER PRODDEL AFTER DELETE ON PRODUCT FOR EACH ROW

BEGIN

DELETE FROM ORDPRD WHERE PCODE=:OLD.PCODE;

END;

When a record is deleted,

DELETE FROM product WHERE pcode=102;

record deleted

records available are 18

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd