Tuesday 15 January 2013

database - Mysql can't update rows when my trigger is called -


My trigger fails when I try to enter a new row in my table because mysql rows in the same table Does not support updating the trigger has been assigned. Is there any suggestion on any good action / alternative?

My Trigger:

  - Trigger DDL statements DELIMITER $ Trigger check, first check INSERT on data for each line if existing (data correct with Select where the sequence = new.) Then update data set sequence = sequence + 1 where the order and gt; = NEW.sequence; end if; END $$ DELIMITER;   

Error SQL, when I try to insert new row:

  Error 1442 (HY000): did not update table 'data' in archived The function can be triggered / triggered because it is already used by the statement that implements this stored function / trigger.   

Thanks for the answer,

In MySQL, Update (or insert) in a trigger for Table A.

You can try a sproc and use the transaction or consider PostgreSQL, which can do this.

No comments:

Post a Comment