尝试创建 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