Error while trying to create mysql stored procedure.Here is stored procedure
DELIMITER $$
CREATE
PROCEDURE `crossqueue_bw`.`pr_SaveProfile`(IN vProfileId INT)
BEGIN
IF SELECT COUNT(ProfileId) FROM tblprofile WHERE ProfileId=vProfileId > 0 THEN
ELSE
END IF;
END$$
DELIMITER ;
Here is the 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 'select count(ProfileId) from tblprofile where ProfileId=vProfileId > 0 then
' at line 6
Update::
tried with this query
DELIMITER $$
CREATE
PROCEDURE `crossqueue_bw`.`pr_SaveProfile`(IN vProfileId INT)
BEGIN
DECLARE v_count INT;
v_count = SELECT COUNT(ProfileId) FROM tblprofile WHERE ProfileId=vProfileId;
IF v_count > 0 THEN
ELSE
END IF;
END$$
DELIMITER ;
Here is the error
Error Code : 1064
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 '= SELECT COUNT(ProfileId) FROM tblprofile WHERE ProfileId=vProfileId;
if v_cou' at line 7
actually dere were 2 errors one as reported by @Sashi the missing parenthesis and other was that atleast one condition should be there inside the if and else portion else it will show error.
Here is the working code