【发布时间】:2014-06-15 16:25:28
【问题描述】:
这两个存储过程都在我的 MySQL 5.1.73 服务器中编译:
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 ;
执行CALL get_admins();会返回我期望的结果。
执行CALL get_admins2('admin'); 错误:
错误代码:1267。非法混合排序规则 (utf8_general_ci,IMPLICIT) 和 (utf8_unicode_ci,IMPLICIT) 用于操作 '='
细心的响应者会注意到两个结果查询之间没有功能差异。我仔细检查了Accounts.type 确实是varchar(50)(即使它被不幸命名了)。
Sam Hill 中发生了什么?
【问题讨论】:
标签: mysql stored-procedures parameter-passing mysql-5.1