MySQL Forums
Forum List  »  Triggers

after insert trigger problem
Posted by: diego hernandez
Date: September 24, 2012 10:43AM

hi, i'm new with mysql and i have a problem that i don't undertand what happend.
i'm using mysql workbench 5.2.37
thats what i've done

delimiter [;
create trigger trans_back_up1
after insert on trans_tabla1
for each row
begin
delete from trans_tabla_inter;
insert into trans_tabla_inter(nombre_tabla) values ('trans_tabla1');
end;
[;

delimiter [;
create trigger trans_back_up2
after insert on trans_tabla_inter
for each row
begin
insert into trans_tabla_back_up
select *
from trans_tabla1;
end;
[;

the problem is that when i insert into trans_tabla1, 5 rows from a file, i have the 5 rows fine on trans_tabla1 but on the table trans_tabla_back_up i have duplicates, i have 5 copies of the first row, 4 copies of the second, 3 of the third, 2 of the fourth , and 1 of the fifth.


can someone tell me where is the error

Options: ReplyQuote


Subject
Views
Written By
Posted
after insert trigger problem
2780
September 24, 2012 10:43AM


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.