This question already has an answer here:
- IF syntax error 3 answers
- mySQL - If statement giving syntax error 3 answers
I have a code like this.
SET @empty = 0;
IF (@empty = 0)
THEN
insert into ComputeTasking.Response SET RequestTaskID=@rid,`ResponseJSON`=@JSON;
ELSE
insert into ComputeTasking.Response SET `ResponseJSON`=@JSON;
END IF;
This returns error
[ERROR in query 1] 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 'IF (@empty)
THEN
select @empty' at line 1
What should I do here?
Thank you!
Aucun commentaire:
Enregistrer un commentaire