MySQL Forums
Forum List  »  Triggers

Re: why the trigger is not working while refering other tables?
Posted by: Jay Pipes
Date: June 28, 2005 02:13PM

What version of MySQL are you using? If > 5.0.4, you can indeed use table references. Please explicitly use LOCK TABLES for the tables you'll be using in the trigger:

SET @@AUTOCOMMIT=0;
START TRANSACTION;
LOCK TABLES registeredUser WRITE, Seller WRITE, Buyer WRITE, mysql.proc READ;
UPDATE registeredUser SET activation = 1 WHERE userID=123;
// Should insert appropriately into Seller and Buyer
UNLOCK TABLES;
COMMIT;

Obviously, I made up the WHERE userID=123 part; you can replace with the correct field.

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: why the trigger is not working while refering other tables?
3712
June 28, 2005 02:13PM


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.