MySQL Forums
Forum List  »  Triggers

Creating trigger
Posted by: Jorge Ferreira
Date: June 06, 2006 03:23AM

I've got two databases, and each time i got an insertion in a table it is supose to insert the same record in another table in another database. So far so good it works. The problem is that if i try to condition it with a IF it doesn't work.
What is my mistake?
Here is the code
------------------------------------
DELIMITER &&

CREATE TRIGGER trINSEmp AFTER INSERT ON empresa
FOR EACH ROW BEGIN
IF NEW.formacao = 1
BEGIN
START TRANSACTION;
INSERT INTO formacao.empresa SET nome_empresa = NEW.nome_empresa, id_empresa = NEW.id;
COMMIT;
END;
END;
&&

DELIMITER ;

Thank you,

Jorge Ferreira

Options: ReplyQuote


Subject
Views
Written By
Posted
Creating trigger
2600
June 06, 2006 03:23AM


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.