Hello.




I'm able to insert a record with a trigger to another table at least

at 5.0.10. May be these lines from ChangeLog shows new behavior:



"It is no longer necessary to issue an explicit LOCK TABLES for any

tables accessed by a trigger prior to executing any statements that

might invoke the trigger. (Bug #9581, Bug #8406)"



And here is the example of how it works:



mysql> create table tt(a int);

Query OK, 0 rows affected (0.02 sec)



mysql> create table tb(b int);

Query OK, 0 rows affected (0.01 sec)

mysql> delimiter $$

mysql> create trigger ttr  before insert on tt for each row begin insert

into tb set b = NEW.a; end $$

Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;

mysql> insert into tt set a=1;

Query OK, 1 row affected (0.00 sec)



mysql> select * from tb;

+------+

| b    |

+------+

|    1 |

+------+

1 row in set (0.00 sec)



And we see the value 1 in table tb which was inserted into table tt.







"Fredrick Bartlett" <[EMAIL PROTECTED]> wrote:

> Am I reading the documentation correctly. I cannot us a trigger to insert a

> record into an other table??? I use triggers on other dbms to create an

> acivity histoy table.

> 

> Fredrick

> 

> 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to