MySQL Forums
Forum List  »  Triggers

Re: 'multiple triggers with the same action time and event for one table'
Posted by: William Chiquito
Date: July 12, 2007 03:21PM

Hi Hasmukh,

1.- You must have one and single one to trigger BEFORE INSERT for the table "calculation".
2.- You cannot insert to the same table that active trigger. Must do something like:
DELIMITER $$

DROP TRIGGER /*!50033 IF EXISTS */ `mul1`$$

CREATE TRIGGER `mul1` BEFORE INSERT on `calculation`
FOR EACH ROW
BEGIN
	SET NEW.total = NEW.qty * NEW.rate;
END$$

DELIMITER ;

INSERT INTO calculation VALUES (100, 100, NULL);

SELECT * FROM calculation;
Result:
   qty    rate  total 
------  ------  ------
   100     100   10000

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: 'multiple triggers with the same action time and event for one table'
13937
July 12, 2007 03:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.