MySQL Forums
Forum List  »  Triggers

#1064 - You have an error in your SQL syntax
Posted by: josep subira
Date: May 23, 2017 09:32AM

Hi
Im new in sql and Im trying to create trigger to update a date field on a table. It gives me an error and Im not able to find where is the mistake... any help? thanks



DELIMITER $$
CREATE TRIGGER subject1 AFTER INSERT ON table1
FOR EACH ROW BEGIN
DECLARE variable1 int;
SET variable1 = (select dayJob from table1);
IF variable1 > 0 THEN
table1.newdate = DATE_ADD(table1.newdate,INTERVAL variable1 DAY)
end if
END$$

DELIMITER ;

Options: ReplyQuote


Subject
Views
Written By
Posted
#1064 - You have an error in your SQL syntax
1711
May 23, 2017 09:32AM


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.