Dev Research Dev Research - 1 month ago 5
SQL Question

how to get output value in from procedure in mysql

CREATE DEFINER=`root`@`localhost` PROCEDURE `test`(out myvalue int)
BEGIN
select count(*) from EventList_View group by eventId into myvalue ;
END


this is my Procedure i am calling this Procedure call test(@output);
select @output; like this but i am unable to get value of output parameter as myvalue . while i am trying to execute select count(*) from EventList_View group by eventId this query i am getting value 5 please tell me how to get output value where am doing wrong in procedure .

Answer
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

apply this query