MySQL Forums
Forum List  »  Stored Procedures

how to store output of dynamic sql statement in mysql stored procedure
Posted by: chakravarthy l
Date: October 24, 2013 05:02AM

BELOW IS MY Dynamic sql

set @Dquery = CONCAT('SELECT Count(*) FROM bankaccount ba INNER JOIN bankbranch b ON b.code = ba.BANKBRANCH_CODE INNER JOIN village v ON ba.BANKBRANCH_CODE = v.branchcode WHERE b.code=',@bank_branch_id,' AND ba.entity = ''CBS'' AND CBSACCOUNTNUMBER IS NOT NULL',' and v.CODE= ',@village_code);


PREPARE s1 FROM @Dquery;
EXECUTE s1;
DEALLOCATE PREPARE s1;

how can I store the Count(*) into a variable called _count

Options: ReplyQuote


Subject
Views
Written By
Posted
how to store output of dynamic sql statement in mysql stored procedure
3232
October 24, 2013 05:02AM


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.