QueryException when searching for an empty string
Trailblazer Community

QueryException when searching for an empty string

Commerce Cloud API/OCAPI

Last updated 2020-06-09 ·Reference W-7122117 ·Reported By 1 users

In Review

Summary
Querying the database with an empty string comparison results in a com.demandware.beehive.core.capi.search.QueryException: Error executing query error message.

Repro
Query the database using a comparison to an empty string like what is shown below:
dw.object.SystemObjectMgr.querySystemObjects("Order", "orderNo = {0}", "orderNo asc", "");
dw.object.SystemObjectMgr.querySystemObjects("Order", "orderNo = ''", "orderNo asc");

Workaround
Use NULL instead of an empty string as outlined below:
dw.object.SystemObjectMgr.querySystemObjects("Order", "orderNo = {0}", "orderNo asc", null);
dw.object.SystemObjectMgr.querySystemObjects("Order", "orderNo = NULL", "orderNo asc");

Reported By (1)

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.