I have been receiving always an error while creating mysql function in cpanel with below code. But the below code is running properly while creating mysql function in SQL Manger 2007. Anyone tell me what is wrong with this code for cpanel.
ERROR :- 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 12 (0.81 sec)
CREATE FUNCTION F_test (topsbwynum INTEGER)
RETURNS float(20,2)
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
BEGIN
DECLARE FinalPrice VARCHAR(20);
DECLARE err VARCHAR(20);
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET err = 1;
IF(sbwynum > 0)THEN
IF(FinalPrice > 0)THEN
RETURN FinalPrice;
ELSEIF(adjprice > 0)THEN
RETURN adjprice;
ELSEIF(price > 0)THEN
RETURN price;
ELSEIF(estprice > 0)THEN
RETURN estprice;
ELSE
RETURN 0;
END IF;
ELSE
RETURN 0;
END IF;
END;
Thanks a lot.