stored procedures - Laravel 5.4: Illegal mix of collations -
i have next error when i'm calling stored procedure:
sqlstate[hy000]: general error: 1267 illegal mix of collations (utf8mb4_general_ci,implicit) , (utf8mb4_unicode_ci,implicit) operation '=' (sql: call sp_getusuarios())
i'm using mariadb, , in database configuration have:
'mysql' => [ 'driver' => 'mysql', 'host' => env('db_host', '127.0.0.1'), 'port' => env('db_port', '3306'), 'database' => env('db_database', 'forge'), 'username' => env('db_username', 'forge'), 'password' => env('db_password', ''), 'unix_socket' => env('db_socket', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, ],
i have eleven others stored procedures work fine. not work..
check collation type of each table, , make sure have same collation.
after check collation type of each table field have use in operation.
i had encountered same error, , tricks works on me.
you either need add collate
where
clause,
or add in parameter definition,
or alter field itself:
alter table tablea character set utf8 collate utf8_general_ci;
as default collation stored procedure parameters utf8_general_ci
, can't mix collations.
unless need sort data in unicode order, suggest altering tables use utf8_general_ci
collation.
wiki
Comments
Post a Comment