简体   繁体   English

MySQL存储过程返回错误结果

[英]MySQL Stored Procedure Returning Wrong Result

I cannot work out what I am doing wrong. 我无法弄清楚自己在做什么错。 My tables has 1262717 rows. 我的表有1262717行。

I have this SQL: 我有这个SQL:

SELECT count(hud_case_number) FROM suitecrm.ht_homes where hud_case_number = "abc"

Which correctly replies with 0 正确回复0

When I convert it to a stored procedure: 当我将其转换为存储过程时:

CREATE DEFINER=`root`@`%` PROCEDURE `hud_does_property_exist`(IN hud_case_number varchar(20))
BEGIN
SELECT count(hud_case_number) FROM suitecrm.ht_homes where hud_case_number = hud_case_number;
END

and call it like this: 并这样称呼它:

Call hud_does_property_exist('abc')

It returns the answer 1262717 它返回答案1262717

I just cannot see what I am doing wrong. 我只是看不到我在做什么错。 I suspect it's something to do with the hud_case_number parameter? 我怀疑这与hud_case_number参数有关吗?

Try This :- 尝试这个 :-

CREATE DEFINER=`root`@`%` PROCEDURE `hud_does_property_exist`(IN 
in_hud_case_number varchar(20))
BEGIN
  SELECT count(hud_case_number) FROM suitecrm.ht_homes where hud_case_number = 
  in_hud_case_number;
END

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM