Re: before update trigger syntax

2006-11-29 Thread ViSolve DB Team

Hi

Try with
mysql> delimiter //
mysql>  CREATE TRIGGER eat_lub BEFORE UPDATE ON d
   -> FOR EACH ROW BEGIN
   -> UPDATE d SET NEW.s=user();
   -> END//
Query OK, 0 rows affected (0.03 sec)

mysql> delimiter ;


Hope this helps.

Thanks,
ViSolve DB Team

- Original Message - 
From: "Ted Yu" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, November 30, 2006 9:13 AM
Subject: before update trigger syntax



Can someone tell me what's wrong with my before update
trigger syntax ?

Thanks

Welcome to the MySQL monitor.  Commands end with ; or
\g.
Your MySQL connection id is 19 to server version:
5.0.18-log

mysql> use eventtracker;
Reading table information for completion of table and
column names
You can turn off this feature to get a quicker startup
with -A

Database changed
mysql> CREATE TRIGGER eat_lub BEFORE UPDATE ON
EVENT_ACTION_TYPES
   ->   FOR EACH ROW BEGIN
   -> SET NEW.LAST_UPDATED_BY = USER();  END;
ERROR 1064 (42000): You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'SET NEW.LAST_UPDATED_BY = USER()' at line 3
ERROR 1064 (42000): You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'END' at line 1
mysql> CREATE TRIGGER eat_lub BEFORE UPDATE ON
EVENT_ACTION_TYPES
   ->   FOR EACH ROW BEGIN
   -> UPDATE EVENT_ACTION_TYPES SET
NEW.LAST_UPDATED_BY = USER();  END;
ERROR 1064 (42000): You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'UPDATE EVENT_ACTION_TYPES SET NEW.LAST_UPDATED_BY =
USER()' at line 3
ERROR 1064 (42000): You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'END' at line 1





Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

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





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



before update trigger syntax

2006-11-29 Thread Ted Yu
Can someone tell me what's wrong with my before update
trigger syntax ?

Thanks

Welcome to the MySQL monitor.  Commands end with ; or
\g.
Your MySQL connection id is 19 to server version:
5.0.18-log

mysql> use eventtracker;
Reading table information for completion of table and
column names
You can turn off this feature to get a quicker startup
with -A

Database changed
mysql> CREATE TRIGGER eat_lub BEFORE UPDATE ON
EVENT_ACTION_TYPES
->   FOR EACH ROW BEGIN
-> SET NEW.LAST_UPDATED_BY = USER();  END;
ERROR 1064 (42000): You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'SET NEW.LAST_UPDATED_BY = USER()' at line 3
ERROR 1064 (42000): You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'END' at line 1
mysql> CREATE TRIGGER eat_lub BEFORE UPDATE ON
EVENT_ACTION_TYPES
->   FOR EACH ROW BEGIN
-> UPDATE EVENT_ACTION_TYPES SET
NEW.LAST_UPDATED_BY = USER();  END;
ERROR 1064 (42000): You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'UPDATE EVENT_ACTION_TYPES SET NEW.LAST_UPDATED_BY =
USER()' at line 3
ERROR 1064 (42000): You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'END' at line 1



 

Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

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