0
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 .

6
  • Do Tag which are related only to your Question. I think SQL Server Tag doesn't suits your query. Commented Oct 20, 2016 at 4:46
  • Possible duplicate of mysql stored-procedure: out parameter Commented Oct 20, 2016 at 5:04
  • That is a horrible select stmt you have going there. Do you see why? Commented Oct 20, 2016 at 5:14
  • Well then let me tell ya. When you have more than one value of eventId in the table, you will get Error Code: 1172. Result consisted of more than one row Commented Oct 20, 2016 at 5:22
  • NO its contain only one count Commented Oct 20, 2016 at 5:24

1 Answer 1

2
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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.