Bug #10528 Numeric value comparisons fail in Stored proc if datatypes not identical
Submitted: 11 May 2005 5:56 Modified: 11 May 2005 6:14
Reporter: Guy Harrison Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.4 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[11 May 2005 5:56] Guy Harrison
Description:
If a parameter in a stored proc is defined as an int, and is used in a where clause to select rows from a table based on a comparison with a decimal(8,0) column then the select will incorrectly return no values.

How to repeat:
create table test4
 (x decimal(8,0));
 
insert into test4 values(1);

create procedure sp_test4a(in_value INT)
BEGIN
	Select * from test4 where x=in_value;
END;

create procedure sp_test4b(in_value DECIMAL(8,0))
BEGIN
	Select * from test4 where x=in_value;
END;

CALL sp_test4a(1);

CALL sp_test4b(1);

sp_test4a returns no rows.  sp_test4b does return rows.
[11 May 2005 6:14] Hartmut Holzgraefe
Verified with 5.0.4, works fine with current source.