ERROR 1064 (42000) with triggers
Hello
I have a table named country
in this table there is the columns name, capital, code, old_capital, datechanged
i have to make a trigger that will add to old_capital the old name of the capital, and in datechanged the date when the modification happened
I have made this trigger:
delimiter |
CREATE TRIGGER change_capital before UPDATE ON country
FOR each ROW
begin
INSERT INTO country (anciennecap) VALUES (OLD.Capital);
INSERT INTO country (datechange) VALUES (NOW());
end|
but it shows me the error:
ERROR 1442 (HY000): Can't update table 'country' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
I do not understand my mistake. Can anyone help me out?
Thank you
Subject
Views
Written By
Posted
ERROR 1064 (42000) with triggers
5569
December 11, 2011 12:48PM
1975
December 11, 2011 01:58PM
1922
December 11, 2011 02:38PM
1911
December 11, 2011 02:59PM
2271
December 11, 2011 03:19PM
1657
December 11, 2011 05:02PM
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.