I'm trying to use dbup to automate running db scripts in my .NET 7 app. So far the scripts to create tables are fine (ofcourse after making lots of tweeks), but the stored procedures are being problematic.
...
BEGIN
IF (SELECT COUNT(*) FROM mytable WHERE REPLACE(TRIM(name), ' ', '') = trimmed_name) > 0
AND (SELECT REPLACE(TRIM(name), ' ', '') WHERE id=categoryId) != trimmed_name
THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Category with given name already exists';
ELSE
UPDATE mytable SET name=categoryName, description=description
WHERE id = categoryId;
END IF;
END
Having the error message below: 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 '' at line 21
Line 21 is the SET MESSAGE_TEXT line
Generally, I want to know if there are keywords I can't use with dbup, cos I it throws errors same error if I declare a variable with "DECLARE"
I have refactored, taken out spaces, still no positives