SOQL中的LIKE运算符不会转义特殊字符

时间:2013-04-18 11:40:43

标签: salesforce sql-like soql

下面是我的SOQL qoery

SELECT ID,Name, Dodge_Report_Number__c,Project_Name__c,Bid_Date__c,GC_Awarded__c,Action_Stage__c,Target_Start_Date__c,Project_Valuation_High__c,Project_Valuation_Low__c,Type_Of_Work__c,Removed_By__r.Name, Removed_By__r.LastName ,Removed_By__r.FirstName,Reason_Removed_Comments__c,Reason_Why_Project_Removed__c,Branch_ID__c FROM Dodge_Project__c WHERE Branch_ID__c != null AND CreatedDate >= LAST_QUARTER AND CreatedDate <= THIS_QUARTER AND Job_Profile_Status__c NOT IN('Created','Removed') AND Branch_ID__c IN('101','102','909','903','941','994','217','904') AND (Action_Stage__c IN ('Start','Construction') OR GC_Awarded__c = TRUE) and (Name like 'P@#$&(%' or Dodge_Report_Number__c like 'P@#$&(%' or Project_Name__c like 'P@#$&(%' or Action_Stage__c like 'P@#$&(%' or Type_Of_Work__c like 'P@#$&(%' or Removed_By__r.Name like 'P@#$&(%' or Reason_Why_Project_Removed__c like 'P@#$&(%' or Branch_ID__c like 'P@#$&(%') order by Name asc NULLS FIRST

我收到错误,例如&#34;在过滤器值中找到无效字符&#34; P @#$&amp;(%&#34;用于&#34;喜欢&#34;运算符&#34 ;

如果我写像

这样的查询
SELECT ID,Name, 

Dodge_Report_Number__c,Project_Name__c,Bid_Date__c,GC_Awarded__c,Action_Stage__c,Target_Start_Date__c,Project_Valuation_High__c,Pro

ject_Valuation_Low__c,Type_Of_Work__c,Removed_By__r.Name, Removed_By__r.LastName 

,Removed_By__r.FirstName,Reason_Removed_Comments__c,Reason_Why_Project_Removed__c,Branch_ID__c FROM Dodge_Project__c WHERE 

Branch_ID__c != null AND CreatedDate >= LAST_QUARTER AND CreatedDate <= THIS_QUARTER AND Job_Profile_Status__c NOT IN

('Created','Removed') AND Branch_ID__c IN('101','102','909','903','941','994','217','904') AND (Action_Stage__c IN 

('Start','Construction') OR GC_Awarded__c = TRUE) and ( Project_Name__c like 'P@#$&(%' ) order by Name asc NULLS FIRST

工作正常。

问题是什么? 感谢。

0 个答案:

没有答案