我想从存储过程返回一个输出参数。我已经写了下面的查询,但是输出参数给出的是空值
CREATE DEFINER=`root`@`%` PROCEDURE `GetVendorSpecificReport`(
startdate DATE,
enddate DATE,
vendorname varchar(50),
out vendoremail varchar(50)
)
BEGIN
SELECT email into vendoremail from user where FirstName=@vendorname;
select distinct concat(u.Firstname, ' ', u.Lastname) as Name,
u.FirstName, t.subtask, u.NTName, from user U, task t, groupuser g, `group` g1
where U.idUser= t.userid and g.userid= U.idUser
and g1.name=vendorname and date >= startdate and date <= enddate
order by date,u.FirstName asc;
END $$
DELIMITER ;
有人能帮我吗?
1条答案
按热度按时间gmxoilav1#
您应该在代码中将“@vendorname”替换为“vendorname”。您可以尝试简化代码或创建另一个非常简单的测试sp进行检查。
以下是在我的系统中运行良好的简单sp: