A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
how to use triggers on mysql - query produce error
Joined: Sep 10, 2004
Oct 16, 2007 21:43:00
Can anyone advise why this sql statement is incorrect?
I'm trying to learn how to use triggers on mysql
CREATE TRIGGER T1 AFTER UPDATE ON cars FOR EACH ROW BEGIN IF (fax_number='555555' where car_id='6723') THEN UPDATE cars set car_name = 'test' where car_id='6723'; END IF; END
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 'where car_id='6723' )
UPDATE cars set car_n
* using mysql version: 5.0.45-community-nt
Joined: Oct 06, 2007
Oct 17, 2007 11:34:00
I have no idea why you'd want to use a trigger for something this specific... but something more like this:
CREATE TRIGGER T1
AFTER UPDATE ON cars
FOR EACH ROW
IF (fax_number='555555' and car_id='6723') THEN
set car_name = '
If the columns you are
for are being updated... you will new to use NEW/OLD depending on your test state.
I agree. Here's the link:
subject: how to use triggers on mysql - query produce error
Java mySql update statement
Update query is wrong?
Entity Bean problem - ejbStore
how to create MySql stored procedure?
SQL Syntax Error for MySQL but not sure where...
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014