CREATE DEFINER=`root`@`localhost` PROCEDURE `test`(out myvalue int)
BEGIN
select count(*) from EventList_View group by eventId into myvalue ;
END
这是我的程序,我正在调用此程序调用 test(@output);
select @output;
像这样,但我无法获取输出参数的值作为 myvalue 。当我尝试执行 select count(*)
from EventList_View group by eventId 这个查询时,我得到值 5,请告诉我如何在程序中做错的地方获取输出值。
最佳答案
CREATE DEFINER=`root`@`localhost` PROCEDURE `test`(out myvalue int)
BEGIN
select count(*) from (select * from events group by event_id) as totalcount into myvalue;
END
应用此查询
关于mysql - 如何从mysql中的过程中获取输出值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40145612/