Event Statement Error Help please
Posted by:
Me You
Date: August 19, 2009 04:51PM
Hey,
So I'm having a little problem with my event creation
here is the code:
CREATE EVENT GATHER_RESOURCE_OIL_VILLAGE1
ON SCHEDULE EVERY 10 SECOND
DO
BEGIN
DECLARE oil,oilrate,result,maxstorage INTEGER;
DECLARE cur_oil CURSOR FOR SELECT R_Oil_Current FROM resources WHERE V_ID='1';
DECLARE cur_oilrate CURSOR FOR SELECT R_Oil_Rate FROM resources WHERE V_ID='1';
DECLARE cur_maxstorage CURSOR FOR SELECT R_Oil_Rate FROM resources WHERE V_ID='1';
OPEN cur_oil;
FETCH cur_oil INTO oil;
CLOSE cur_oil;
OPEN cur_oilrate;
FETCH cur_oilrate INTO oilrate;
CLOSE cur_oilrate;
OPEN cur_maxstorage;
FETCH cur_maxstorage INTO maxstorage;
CLOSE cur_maxstorage;
SET result = oil + oilrate;
IF result < maxstorage THEN
UPDATE resources SET R_Oil_Current = oil;
ELSE IF result > maxstorage THEN
DELETE FROM EVENTS WHERE EVENT_NAME = 'GATHER_RESOURCE_OIL_VILLAGE1';
END IF
END;//
But it gives me a SQL syntax error :
#1064 - 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 30
I can't seem what the problem is, could somebody help me please :(
thx
Subject
Views
Written By
Posted
Event Statement Error Help please
2208
August 19, 2009 04:51PM
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.