Couple of weeks ago, I was stumped by this cryptic ColdFusion error:
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code. Null pointers are another name for undefined values.
The piece of code was always working up until that point, I narrowed down the error down to the Query of Query (QoQ) code. Googling around I found out that the cause of the problem was: LIKE operator in QoQ found NULL values in the query result (prior to this point there was no NULL values on the table) and basically don’t know what to do with it and went kaboom! This post helps me solving the problem: QoQ and LIKE operator
This is the original query – which will bombed out when it sees NULL values: [coldfusion] <cfquery name="qFields" dbtype="query"> SELECT * FROM qFields WHERE fieldName NOT LIKE ‘%ExperienceLevel%’ </cfquery> [/coldfusion] This is the error proof QoQ to deal with the error: [coldfusion] <cfquery name="qFields" dbtype="query"> SELECT * FROM qFields WHERE fieldName IS NOT NULL AND fieldName NOT LIKE ‘%ExperienceLevel%’ </cfquery> [/coldfusion] So here’s the lesson – if you are using LIKE operator on QoQ – make sure you put an additional check for NULL values. Come to think of it, is this a bug or intended behaviour?