CASE expression WHEN condition1 THEN result1 WHEN condition2 THEN result2. WHEN conditionN THEN resultN ELSE result END. In your query the case statement is missing END. Achei a solução, apenas um ; depois do END IF - END IF;. MySQLWorkbench advise me that it miss ' end' to my first SET, but not for the second. I don' t know why. The error is " Syntax error : missing ' end' ". If i execute, SQL code error : 1064 – Romain Caron Jun 18 ' 15 at 13: 53. dont forget to change the default DELIMITER so the query won' t terminate at DECLARE bramek INT; DROP FUNCTION IF EXISTS bramkiStracone; DELIMITER $ $ CREATE FUNCTION bramkiStracone( idDruzyny INT). END compound statement and must be at its start, before any other statements. SELECT ` column` ; IF done THEN LEAVE read_ loop; END IF; END LOOP; CLOSE column_ cursor; END/ / DELIMITER ;.
Okay, problem solved. First, I needed to use delimiters to avoid the error near end if;. For the next error, MySQL requires declare statements to be put next to the begin, thanks to this post I found the answer. I just changed the comment syntax from single quote to - -, and it worked:. CANT_ VENTA, COD_ DET_ VENT; - - valido que no sea el ultimo registro' IF @ hecho THEN LEAVE recorrido; END IF; - - Busco la cantidad actual del. Try like this: DROP procedure IF exists getQueueMessage; DELIMITER $ $ CREATE PROCEDURE ` getQueueMessage` ( msg varcharBEGIN SELECT ` Name` FROM queues WHERE Id IN. If using MySQL Workbench then Editor' s create trigger under table design options should be used to avoid changing delimiters before and after. share| improve this answer. answered May 16 at 6: 43. You may need to use the word THEN on the same line as the IF, and use END IF instead of BEGIN END blocks. IF < statement> THEN.
See here for MySQL syntax. If you just use:. IF NOT EXISTS( SELECT * FROM.