title: mysql number of records in cursor without iterating?
body: <p>I am trying to write mysql procedure for below logic,</p>
  
  <pre><code>select id, fullname from users where fullname like concat(lastname, ' ', firstname, ' (' , middlename, '%');
  </code></pre>
  
  <p>if above query returns 0 records then</p>
  
  <pre><code>    select id, fullname from users where fullname like concat(lastname, ' ', firstname, '%');
  
  .... few more queries depending upon result,
  </code></pre>
  
  <p>I am trying to write procedure mysql procedure , in that, I am using mysql cursor,</p>
  
  <pre><code>DECLARE user_cnt CURSOR FOR select id, fullname from users where fullname like concat(lastname, ' ', firstname, ' (' , middlename, '%'); 
  </code></pre>
  
  <p>now I want to check number of records in user_cursor so that I can check the condition "if  query returns 0 records then"</p>
  
  <p>How can I find the number of records in mysql cursor without iterating on it ?</p>