title: How to print a variable in SQL stored procedure?
body: <pre><code>CREATE DATABASE loan_data;
  USE loan_data;
      
  CREATE TABLE loan_user (
      id long,
      amount long
      );
      
  INSERT INTO loan_user(id, amount)
  values (1,7000), (2,7000), (3,5000);
  
  DELIMITER $$
  CREATE PROCEDURE loan_check()
  BEGIN
  DECLARE a int;  
  select a = count(amount) from loan_user where amount=7000;
  print a;
  END $$
  
  DELIMITER ;
  CALL loan_check();
  
  DROP DATABASE loan_data;
  </code></pre>
  <p>I want to print the <code>a</code> variable in the above code. But the code returns</p>
  <pre><code>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a;
  END' at line 5
  </code></pre>
  <p>How to fix this?</p>