Passionate Development From Journeyman to Master

CFQuery LIKE on NULL values

I’ve got this query of query: [code=”sql”] SELECT * FROM qSectionArticles WHERE displays LIKE ‘%publications%’ [/code]

This code was returning a CF 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.


Stack Trace

	at org.apache.oro.text.regex.Perl5Matcher.matches(Unknown Source)
	at coldfusion.sql.imq.rttExprCondLike.evaluate(
	at coldfusion.sql.imq.rttExprCondTest.evaluate(
	at coldfusion.sql.imq.rttSelectExprSpec.evaluateWhere(
	at coldfusion.sql.imq.rttSelectExprSpec.evaluate(
	at coldfusion.sql.imq.rttSelectStmt.evaluate(
	at coldfusion.sql.imq.jdbcStatement.fetchResult(
	at coldfusion.sql.imq.jdbcStatement.execute(
	at coldfusion.sql.imq.jdbcPreparedStatement.execute(
	at coldfusion.sql.Executive.executeQuery(
	at coldfusion.sql.SqlImpl.execute(
	at coldfusion.tagext.sql.QueryTag.executeQuery(
	at coldfusion.tagext.sql.QueryTag.doEndTag(

It turns out the problem was that I the column that I am querying for (displays column) has a NULL value assigned to it, luckily there are only 5 or so entries in this table, so I can just quickly fill them with values and change the field to not allowing NULL as well as giving it a default value (the database is SQL Server 2000 by the way)