0

I have the following trigger in Oracle database -

CREATE TRIGGER B4DEL
BEFORE DELETE ON test FOR EACH ROW
BEGIN
    IF deleting THEN
        INSERT INTO tab VALUES (:old.oid,'Deleting');
    END IF;
    IF inserting THEN
        INSERT INTO tab VALUES (:new.oid,'Inserting');
    END IF;
END;

I want to do something similar in MySQL database by using a single trigger.

William Robertson
  • 15,273
  • 4
  • 38
  • 44
Vikas Bharti
  • 61
  • 1
  • 7
  • we can't use in MySQL after INSERT or UPDATE description, like in Oracle . read here https://stackoverflow.com/questions/1318224/mysql-fire-trigger-for-both-insert-and-update – XING Oct 23 '17 at 11:20
  • Thanks, I am getting it, but what I want is to differentiate the statements based upon operations within the trigger, simply an alternative to - IF **deleting** THEN ..... END IF; IF **inserting** THEN ....; END IF; part. How to figure out what operation is being performed within the trigger definition. – Vikas Bharti Oct 23 '17 at 16:34

0 Answers0