CREATE PROCEDURE ts(IN col1 varchar(100),IN val int, OUT res int)
BEGIN
SET @s=CONCAT("SELECT ISNULL(NULLIF(",col1,",'')) INTO @res FROM demo WHERE d=",val);
PREPARE stmt1 FROM @s;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
SELECT @res INTO res;
END
我收到以下错误
我想在PHP中使用这个存储过程???请帮助!!
答案 0 :(得分:0)
ISNULL不是SQL92,请尝试:
sum(case when field is null then 1 else 0 end)
更好的便携性