MySQL Forums
Forum List  »  Newbie

Error using triggers
Posted by: Martin Matthews
Date: May 10, 2014 03:28PM

When I try to use the following code I get the error message that follows:

CREATE TRIGGER taxcalc AFTER INSERT ON sales FOR EACH ROW UPDATE sales SET tax = ROUND(amount*.092, 2);
INSERT INTO sales (buyer, product, amount) VALUES
('Linden', 'Tablet AP6', 784.46),
('Meyers', 'Phone AP5c', 469.95),
('Bitts', 'Laptop HP567', 932.75);

“Can’t update table ‘sales’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger."

The error message makes no sense to me. Can anyone explain what I am doing wrong.

Thanks!

Options: ReplyQuote


Subject
Written By
Posted
Error using triggers
May 10, 2014 03:28PM
May 12, 2014 09:02AM


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.