MySQL. 쿼리 수행 시 Illegal mix of collations 오류 본문

IT Cafe+/MySQL

MySQL. 쿼리 수행 시 Illegal mix of collations 오류

고드림 2019. 12. 10. 17:23

SET @V_BASE_YMD = '20190701';
SET @V_START_YMD = '20190201';
SET @V_END_YMD = '20190229';


SELECT  s.column1
          ,s.column2        
  FROM table1        /*table1의 collation은 utf8mb4_0900_bin */
WHERE base_ymd = @V_BASE_YMD 

;

 

실행 시 오류 발생

SQL오류 (1267): Illegal mix of collations (utf8mb4_0900_bin,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation '='

 

 

아래와 같이 WHERE 절에 collate 문 추가해서 해결했어요.

 

SELECT  s.column1
          ,s.column2        
  FROM table1        /*table1의 collation은 utf8mb4_0900_bin */
WHERE base_ymd = @V_BASE_YMD  COLLATE utf8mb4_0900_bin 

;

 

참고로

SET 절도 이용해 봤는데요...안 되네요.

SET collation_server=utf8mb4_0900_bin;

SET @V_BASE_YMD = '20190701';
SET @V_START_YMD = '20190201';
SET @V_END_YMD = '20190229';


        

Comments