I have an error somewhere in my SOQL string but can't figure out where because the only message I'm getting is 'Unknown error parsing query' if I try to execute it in the Query Editor of the dev console, or System.QueryException: expecting a right parentheses, found 'OR'
when I try to test the class.
Is there a tool (either online or in VS Code or as part of the SF dev console) that will let me paste in a SOQL string and highlight the error for me? Is there a limit on the number of nested ORs and ANDs in a query string? Can anybody spot the error in this string?
string q = 'SELECT Id, MailingStreet, MailingCity, MailingState, MailingPostalCode FROM Contact WHERE MailingStreet != NULL AND MailingState=\'OR\' AND ((Active_Worker__c = TRUE AND L503_PIN__c != NULL) OR Has_CareWorks_Record__c = TRUE) AND (District_Update_Date__c = NULL OR Cong_District__c = NULL OR OR_HD__c = NULL OR OR_SD__c = NULL)';
thanks for your help
ETA: to clarify, i am only escaping the single quotes around the state abbreviation (\'OR\') when i'm saving it as a string variable in the apex class. when i execute in the dev console i'm not escaping the quotes. when running in the query builder i'm using
SELECT Id,MailingStreet,MailingCity,MailingState,MailingPostalCode FROM Contact WHERE MailingStreet != NULL AND MailingState='OR' AND ((Active_Worker__c = TRUE AND L503_PIN__c != NULL) OR Has_CareWorks_Record__c = TRUE) AND (District_Update_Date__c = NULL OR Cong_District__c = NULL OR OR_HD__c = NULL OR OR_SD__c = NULL);
still getting 'Unknown error parsing query'.