Subhashkumar Yadav

Subhashkumar Yadav

  • 676
  • 1.3k
  • 58.9k

After Update Trigger Delete Query not Working

Mar 9 2017 4:25 AM
Unable to delete record in trigger.
Can we write Delete statement in After Update Trigger in Oracale?
 
For Example : -
 
My Trigger :
 
Create or replace
TRIGGER TranxMaster_after_update
AFTER UPDATE ON Transaction
FOR EACH ROW
DECLARE vcrTranxID VARCHAR2(100);
BEGIN
INSERT INTO TRANSACTIONNew
( ID,
MOBILENO,
TrnTYPE,
AMOUNT,
TranxID)
VALUES
( :new.ID,
:new.MOBILENO,
:new.TrnTYPE,
:new.AMOUNT,
:new.TranxID)
 
SELECT TranxID INTO vcrTranxID FROM TransactionNew WHERE ID=:new.ID;
 
IF vcrTranxID IS NOT NULL THEN
          DELETE FROM Transaction WHERE ID = :new.ID;
 End IF;
END;
 

Answers (5)