I have the following MySQL function to check for all the words exists in a string.
CREATE DEFINER=`root`@`localhost` FUNCTION `ALL_WORDS`(s TEXT, m TEXT) RETURNS int(11)
BEGIN
DECLARE j INT DEFAULT 1;
DECLARE k INT DEFAULT 1;
DECLARE c INT;
--
SET s=TRIM(s);
--
IF s<>'' AND m<>'' THEN
--
SET s=CONCAT(' ', UCASE(s) , ' ' );
SET m=UCASE(m);
--
SET c=PARSECOUNT(m,' ');
--
a:LOOP
--
IF j=c+1 OR INSTR(s,CONCAT(' ',PARSE(m,' ',j),' ')) =0 THEN
--
LEAVE a;
--
END IF;
--
SET j=j+1;
--
END LOOP;
--
SET k=(j=c+1);
--
END IF;
--
RETURN k;
--
END
When I run I get the following response
Error Code: 1267. Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'instr'