Skip navigation links

MySQL Forums :: Events (Job Scheduler) :: Help getting event to work


Advanced Search

Help getting event to work
Posted by: Jan Klemmensen ()
Date: February 18, 2012 11:52AM

Hi all,

I am trying to create an event which deletes items in a cart more than 1 hour old, and at the same time updates to other tables. - I can see that the event is running, but nothing is being executed, can someone point out what is wrong?

Are the variables being declared wrongly perhaps?

DELIMITER |
CREATE
EVENT delete_cart
ON SCHEDULE EVERY 5 MINUTE
DO
BEGIN

DECLARE cartID INTEGER(11);
DECLARE cartProductID INTEGER (11);
DECLARE cartAntal INTEGER (11);
DECLARE cartStr VARCHAR(5);

SELECT id, produkt_id, antal, str INTO cartID, cartProductID, cartAntal, cartStr FROM cart WHERE added_date >= added_date + 10000 LIMIT 1 ;

UPDATE products SET stock = stock + cartAntal WHERE produkt_id = cartProductID;

UPDATE sizes SET antal = antal + cartAntal WHERE size = cartStr AND product_id = cartProductID;

DELETE FROM cart WHERE id = cartID;

END |
DELIMITER ;

Unfortunately nothing happens at all :-/

I hope somone can see what is wrong here!
Regards Jan Klemmensen

Options: ReplyQuote


Subject Views Written By Posted
Help getting event to work 1366 Jan Klemmensen 02/18/2012 11:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.