title: mysql - Using variable in where clause stored procedure
body: <p>im newbie in Stored Procedure. <br>
  I have simple example of my problem, in SP, I wrote this<br></p>
  
  <pre><code>BEGIN
  DECLARE totalRows INT;
  START 
      SELECT count(cont.contentCode) INTO totalRows FROM ms_content as cont WHERE entityCode = 'ACAW';
      SELECT totalRows;
  COMMIT;
  END
  </code></pre>
  
  <p>I call it, success. I want to add condition where clause in variable. So I change my code to:</p>
  
  <pre><code>BEGIN
  DECLARE totalRows INT;
  START TRANSACTION;
      SET @aa = concat("entityCode = 'ACAW'");
      SELECT count(cont.contentCode) INTO totalRows FROM ms_content as cont WHERE @aa;
      SELECT totalRows;
  COMMIT;
  END
  </code></pre>
  
  <p>SP return zero rows. Its possible to store condition in variable and put it in SELECT code?
  Thank you.</p>