MySQL Forums
Forum List  »  General

Re: Linking data together
Posted by: Peter Brawley
Date: May 19, 2013 11:42AM

> A TRIGGER could change one row when you UPDATE another.

Won't work:

drop table t;
create table t(i int,j int);
insert into t values(1,1),(3,3);
create trigger updt before update on t for each row update t set j=j+1 where i=old.i+1;
update t set j=j+1 where i=1;
ERROR 1442 (HY000): Can't update table 't' in stored function/trigger because it
is already used by statement which invoked this stored function/trigger.

Options: ReplyQuote


Subject
Written By
Posted
May 15, 2013 02:12PM
May 16, 2013 07:20AM
May 18, 2013 01:34PM
Re: Linking data together
May 19, 2013 11:42AM
June 03, 2013 01:27PM


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.