aspose file tools
The moose likes JDBC and the fly likes how to use triggers on mysql - query produce error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "how to use triggers on mysql - query produce error " Watch "how to use triggers on mysql - query produce error " New topic
Author

how to use triggers on mysql - query produce error

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi there,

Can anyone advise why this sql statement is incorrect?
I'm trying to learn how to use triggers on mysql



I get:
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' )
THEN
UPDATE cars set car_n

* using mysql version: 5.0.45-community-nt
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
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
BEGIN
IF (fax_number='555555' and car_id='6723') THEN
set car_name = 'test';
END IF;
END;

If the columns you are testing for are being updated... you will new to use NEW/OLD depending on your test state.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to use triggers on mysql - query produce error
 
Similar Threads
Entity Bean problem - ejbStore
Update query is wrong?
SQL Syntax Error for MySQL but not sure where...
Java mySql update statement
how to create MySql stored procedure?