Hi, I'm having problems with a trigger that I'm working on, I want to create
a trigger that after inserting a row in table A will copy the row to table B
and once there will delete the row from table A.

I'm using two triggers for this one goes on table A and does the copy of the
information to table B after insert.

The other goes on table B and performs (or at least it tries) the delete
command on table A after insert.

The short version o all of this is this:

CREATE DEFINER='[EMAIL PROTECTED]' TRIGGER `DB`.`insTrigger` AFTER INSERT ON 
`DB`.`A`
 FOR EACH ROW begin
insert into B
values(
new.idA
);
end;

CREATE DEFINER='[EMAIL PROTECTED]' TRIGGER `DB`.`delTrigger` AFTER INSERT ON 
`DB`.`B`
 FOR EACH ROW begin
delete from A where idA = new.idB;
end;

But all I get when i try to insert in A is:

Can't update table 'reporte' in stored function/trigger because it is
already used by statement which invoked this stored function/trigger.

Any ideas?

TIA
--
Ivan Milanez Castellanos
+-------------------------------+
| Artificial Intelligence will  |
| Never be able to compete with |
| Natural Stupidity             |
|          -- Isaac Asimov --   |
+-------------------------------+

Reply via email to