KB-1038 "Error evaluating function 'queryruleexec' : Unexpected error executing query" thrown when evaluating query rule


When running a query rule, users can see a vague error similar to the following:

Expression evaluation error in rule '<rule name>' at function 'queryruleexec': Error evaluating function 'queryruleexec' : Unexpected error executing query (type: [<CDT name>], query: [<rule name>], order by: [[]], filters:[null])

The error seen above in Appian generates the following error in the application server log:

ERROR org.hibernate.util.JDBCExceptionReporter - Value '0000-00-00' can not be represented as java.sql.Date
Caused by: com.appiancorp.suiteapi.common.exceptions.AppianRuntimeException: com.appiancorp.suiteapi.common.exceptions.AppianException: Unexpected error executing query
Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
If querying a 'Date and Time' field, the following error may be seen instead: 
ERROR org.hibernate.util.JDBCExceptionReporter - Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp


In the database table that this query rule was querying, there was a date column that had the value 0000-00-00 in one of its rows. Such a date is outside the possible range of values for date types, and could not be displayed.


Either delete the invalid data in the table’s row, or modify it so that it is readable by Appian.

Affected Versions

This article applies to all versions of Appian.

Last Reviewed: August 2019