mysqlストアドプロシージャを作成しようとしたときにエラーが発生しました。ここにストアドプロシージャがあります
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 ;
これがエラーです
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
アップデート::
このクエリで試してみました
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 ;
これがエラーです
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