WHERE PATINDEX ('%pattern%',expression) !=0
If pattern is found , PATINDEX returns non zero value and you need to do a comparison in WHERE clause.
A WHERE
clause must be followed by comparison operation that returns true / false.
May be you are using PATINDEX without doing the comparison and that is why error message shows non boolean expression near WHERE clause.
To search for pattern learner_code with wildcard character
WHERE PATINDEX ('%' + CAST(learner_code AS VARCHAR) +'%',examCodes) !=0