MySQL Forums
Forum List  »  Stored Procedures

Getting Different results from Query Editor and Stored Procedure
Posted by: Kiran Kumar P
Date: March 04, 2015 05:47PM

Hi All,

I have a query which is producing different results while executing from Workbench editor and calling the stored procedure from editor using call statement

The statement i am executing is as follows

sum(PassCount) as PassCount,
sum(FailCount) as FailCount,
sum(NotAttempted) as NotAttempted,
sum(GoalAchieved) as GoalAchieved,
sum(B.AttemptCount) as AttemptCount,
@i as UserCount
FROM usergoalachievement A
join userattemptcount B on B.GoalId=A.GoalId and B.UserProfileId=A.UserProfileId
where B.UserProfileId in (select distinct UserProfileId from usergrouprole where RoleId=4 and GroupId=29)
and FIND_IN_SET(cast(A.GoalId as char),'30' ) and ifnull(ProgressionType,'')=ifnull(@progressionType,'PMP2') ;


now create a new procedure sp_test with the above statement and call the procedure using call statement from workbench

now the result will be as follows

'63', '214', '99', '0', '363', '0'

Why is this different for the same query (usergoalachievement, userattemptcount are views)

again apart for creating the stored procedure there is no change in the statements in editor and stored proc.

Can somebody explain why is this happening

Thanks everybody

Options: ReplyQuote

Written By
Getting Different results from Query Editor and Stored Procedure
March 04, 2015 05:47PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.