0

I encountered and FC on my app when testing on Android 2.1 device. This happens in this query when I want to match PRODUCER_ID to an empty string.

managedQuery(CONTENT_URI, new String[]{Constants.NAME,
Constants.PRODUCER_ID}, Constants.PRODUCER_ID + " IS NULL OR " +
Constants.PRODUCER_ID + " IS ''", null, null);

Exception:

android.database.sqlite.SQLiteException: near "''": syntax error: ,
while compiling: SELECT name, producer_id FROM beverages WHERE
producer_id IS NULL OR producer_id IS ''

What am I doing wrong?

Adrian
  • 334
  • 5
  • 7

1 Answers1

1

Substitute "=" or "like" for "IS".

"is null" or "is in (...)", "is between","is not null", etc etc are all valid. "is ''" isn't.

paulsm4
  • 99,714
  • 15
  • 125
  • 160