List:General Discussion« Previous MessageNext Message »
From:Ted Yu Date:November 30 2006 3:43am
Subject:before update trigger syntax
View as plain text  
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
Thread
before update trigger syntaxTed Yu30 Nov
  • Re: before update trigger syntaxViSolve DB Team30 Nov