Error 1292: Truncated incorrect Double value: ";"
Stored Procedure
=========================================================================
CREATE DEFINER=`root`@`localhost` PROCEDURE `spGetInvoices`(in intVendor int, in dtFrom date, in dtTo date, in strInvNum varchar(20), in strPartNum varchar(45), in strPONum varchar(20))
BEGIN
declare AUTOLIV tinyint;
declare GENTEX tinyint;
declare strSQL varchar(1000);
declare strWhere varchar(255);
Set strWhere = "";
Set AUTOLIV = 1;
Set GENTEX = 2;
Set strSQL = '';
# select 'b4 if';
if (intVendor = AUTOLIV) then
if (strInvNum is not null) then
Set strWhere = " And d.InvNum = " + strInvNum;
end if;
if (strPartNum is not null) then
Set strWhere = " And d.PartNum = " + strPartNum;
end if;
if (strPONum is not null) then
Set strWhere = " And d.RefNum = " + strPONum;
end if;
Set strSQL = "Create temporary table SelectedInvoices Select h.InvDate, d.InvNum, d.ItemNum, d.RefNum, d.PartNum, d.Quantity, d.Price, d.Tax, d.Amount
From invoices_hst as h join
detail_hst as d on d.InvNum = h.InvNum
Where cast(h.InvDate as date) >= " + dtFrom + " And cast(h.InvDate as date) <= " + dtTo +
"UNION
Select h.InvDate, d.InvNum, d.ItemNum, d.RefNum, d.PartNum, d.Quantity, d.Price, 0, d.Amount
From invoices_411 as h join
detail_411 as d on d.InvNum = h.InvNum
Where cast(h.InvDate as date) >= " + dtFrom + " And cast(h.InvDate as date) <= " + dtTo + "\;";
Select strSQL;
else
SELECT 'hI';
end if;
# + '@strWhere' +
# + '@strWhere'
#PREPARE stmt FROM strSQL;
#EXECUTE stmt;
#DEALLOCATE PREPARE stmt;
Drop temporary table SelectedInvoices;
END
=============================================================================
Why am I getting this error?