CREATE DEFINER=`root`@`%` PROCEDURE `sp_search_dir`(
IN name varchar(50),
OUT employeeId varchar(50) ,
OUT employeeName varchar(50)
)
BEGIN
-- First : working ---
SELECT EAE.id INTO employeeId , EAE.name INTO employeeName
FROM employeesDB.employee AS EAE
WHERE EAE.f_name LIKE CONCAT('%', name , '%');
-- Second Working ---
SELECT EAE.id INTO employeeId , EAE.name INTO employeeName
FROM employeesDB.employee AS EAE
WHERE EAE.f_name LIKE CONCAT('%', name , '%');
-- Third NOT working getting syntax ERROR why i am not able to set two
OUT variable in one select
SELECT
EAE.id INTO employeeId ,
EAE.name INTO employeeName
FROM employeesDB.employee AS EAE
WHERE EAE.f_name LIKE CONCAT('%', name , '%');
END
我无法在store-procedure中的单个选择查询中设置多个输出值以获取id和employeename我必须调用两个选择查询我想在一个查询中提取结果..
答案 0 :(得分:1)
您的SELECT ... INTO语法错误。
必须是:
SELECT EAE.id, EAE.name
INTO employeeId, employeeName
FROM employeesDB.employee AS EAE
WHERE EAE.f_name LIKE CONCAT('%', name , '%');