title: why does a parameter passed into a stored procedure cause MySQL error 1267?
body: <p>Both of these stored procedures compile in my MySQL 5.1.73 server:</p>
  
  <pre><code>delimiter $$
  CREATE PROCEDURE get_admins()
      BEGIN
              SELECT *
              FROM Accounts
                  INNER JOIN LINK_Account_Status ON Accounts.account_id=LINK_Account_Status.account_id
                      AND LINK_Account_Status.active_ind=1
              WHERE Accounts.active_ind=1
                  AND Accounts.`type`='admin';
      END $$
  delimiter ;
  
  delimiter $$
  CREATE PROCEDURE get_admins2(
      IN  p_type  varchar(50)
  )
      BEGIN
              SELECT *
              FROM Accounts
                  INNER JOIN LINK_Account_Status ON Accounts.account_id=LINK_Account_Status.account_id
                      AND LINK_Account_Status.active_ind=1
              WHERE Accounts.active_ind=1
                  AND Accounts.`type`=p_type;
      END $$
  delimiter ;
  </code></pre>
  
  <p>Executing <code>CALL get_admins();</code> returns the results I expect.</p>
  
  <p>Executing <code>CALL get_admins2('admin');</code> errors:</p>
  
  <blockquote>
    <p>Error Code: 1267. Illegal mix of collations (utf8_general_ci,IMPLICIT)
    and (utf8_unicode_ci,IMPLICIT) for operation '='</p>
  </blockquote>
  
  <p>The observant responder will notice there is no functional difference between the two resulting queries. I have double-checked that <code>Accounts.type</code> is, indeed, a <code>varchar(50)</code> (even if it is unfortunately-named).</p>
  
  <p>What in the <a href="http://en.wikipedia.org/wiki/Sam_Hill_%28euphemism%29" rel="nofollow">Sam Hill</a> is going on here?</p>