gpt4 book ai didi

mysql - 错误代码 : 1267. 操作 '=' 的排序规则 (utf8_general_ci,IMPLICIT) 和 (utf8_unicode_ci,IMPLICIT) 的非法混合

转载 作者:行者123 更新时间:2023-11-29 21:49:37 25 4
gpt4 key购买 nike

我们正在使用以下存储过程,并且所有提到的表都使用“Collat​​ion = utf8_general_ci”,但我们仍然收到此错误:

Error Code: 1267. Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='

存储过程是:

    DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `AssignCallRates`()
begin
declare countrycode varchar(8000);
declare countryname varchar(8000);
declare currencycode varchar(8000);
declare priceval varchar(8000);
declare mobileprice varchar(8000);
declare landprice varchar(8000);
declare reccnt int;
DECLARE done INT DEFAULT FALSE;
declare country_cursor cursor for select country_code,country_name from dialoone_countries;
declare aud_cursor cursor for select convert(price,char) as price from tbl_rate_aud where quick_search=1 and trim(substring_index(`place`,'-',1)) = countryname LIMIT 0,2;
declare euro_cursor cursor for select convert(price,char) as price from tbl_rate_euro where quick_search=1 and trim(substring_index(`place`,'-',1)) = countryname LIMIT 0,2;
declare gbp_cursor cursor for select convert(price,char) as price from tbl_rate_gbp where quick_search=1 and trim(substring_index(`place`,'-',1)) = countryname LIMIT 0,2;
declare usd_cursor cursor for select convert(price,char) as price from tbl_rate_dollar where quick_search=1 and trim(substring_index(`place`,'-',1)) = countryname LIMIT 0,2;
declare continue handler for not found set done=TRUE;

truncate table tbl_rates;

open country_cursor;
CountryLOOP: loop
fetch country_cursor into countrycode,countryname;
if done=TRUE then
close country_cursor;
leave CountryLOOP;
end if;
set mobileprice = "";
set landprice="";
set reccnt = 0;
set priceval = "";
open aud_cursor;
AUDLOOP: loop
fetch aud_cursor into priceval;
if done = TRUE then
set done = FALSE;
close aud_cursor;
leave AUDLOOP;
end if;
set reccnt = reccnt + 1;
if reccnt = 1 then
set landprice=priceval;
end if;
if reccnt = 2 then
set mobileprice=priceval;
end if;
end loop AUDLOOP;
insert into tbl_rates (country_code,currency_code,mobile,land) values (countrycode,"AUD",mobileprice,landprice);

set mobileprice = "";
set landprice="";
set reccnt = 0;
set priceval = "";
open euro_cursor;
EUROLOOP: loop
fetch euro_cursor into priceval;
if done = TRUE then
set done = FALSE;
close euro_cursor;
leave EUROLOOP;
end if;
set reccnt = reccnt + 1;
if reccnt = 1 then
set landprice=priceval;
end if;
if reccnt = 2 then
set mobileprice=priceval;
end if;
end loop EUROLOOP;
insert into tbl_rates (country_code,currency_code,mobile,land) values (countrycode,"EUR",mobileprice,landprice);

set mobileprice = "";
set landprice="";
set reccnt = 0;
set priceval = "";
open gbp_cursor;
GBPLOOP: loop
fetch gbp_cursor into priceval;
if done = TRUE then
set done = FALSE;
close gbp_cursor;
leave GBPLOOP;
end if;
set reccnt = reccnt + 1;
if reccnt = 1 then
set landprice=priceval;
end if;
if reccnt = 2 then
set mobileprice=priceval;
end if;
end loop GBPLOOP;
insert into tbl_rates (country_code,currency_code,mobile,land) values (countrycode,"GBP",mobileprice,landprice);

set mobileprice = "";
set landprice="";
set reccnt = 0;
set priceval = "";
open usd_cursor;
USDLOOP: loop
fetch usd_cursor into priceval;
if done = TRUE then
set done = FALSE;
close usd_cursor;
leave USDLOOP;
end if;
set reccnt = reccnt + 1;
if reccnt = 1 then
set landprice=priceval;
end if;
if reccnt = 2 then
set mobileprice=priceval;
end if;
end loop USDLOOP;
insert into tbl_rates (country_code,currency_code,mobile,land) values (countrycode,"USD",mobileprice,landprice);
end loop CountryLOOP;
select "Query Executed Successfully";
end$$
DELIMITER ;

此 SP 需要更新吗?

最佳答案

From other answer:存储过程参数的默认排序规则是 utf8_general_ci,并且不能混合排序规则,因此这意味着数据库/表可能是 unicode。

首先尝试这个:

SELECT @@collation_database;

然后查看您正在使用的实际表的 CREATE 语句。

More Info

关于mysql - 错误代码 : 1267. 操作 '=' 的排序规则 (utf8_general_ci,IMPLICIT) 和 (utf8_unicode_ci,IMPLICIT) 的非法混合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33775062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com