First error: common.exception.SfdcSqlException: ORA-00920: invalid relational operator

889    Asked by CelinaLagunas in AWS , Asked on Jul 19, 2021

I have created formula field named "Second Audit Required" as shown below :

IF(And(AND(Text(Status__c)='Closed',TEXT(ServiceStep__c)='Treatment',Order__r.Account_Name__r.Account_Types__r.Name='Individual'), AND(Sequence_No__c=1),And(Text(Service_Audit_Type__c) !='Second Audit')), IF(Order_Service_Area__r.Service_Plan__r.SP_Code__c<>Null, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0875",TODAY()- Delivery_Date__c>1460 ),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0573",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0726",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0070",TODAY()-Delivery_Date__c>365),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0634",TODAY()-Delivery_Date__c>730),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0577",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0072",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0469",TODAY()-Delivery_Date__c>1460),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0724",TODAY()-Delivery_Date__c>365),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0438",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0725",TODAY()-Delivery_Date__c>730),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0584",TODAY()-Delivery_Date__c>730),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0723",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0729",TODAY()-Delivery_Date__c>1460),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0067",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0443",TODAY()-Delivery_Date__c>1460),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0627",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0727",TODAY()-Delivery_Date__c>180),True, IF(AND(Order_Service_Area__r.Service_Plan__r.SP_Code__c="SP0728",TODAY()-Delivery_Date__c>365),True, False))))))))))))))))))),False),False)

When I am doing a query in batch class and using this field to retrieve and filter I am getting an error as below : First error: common.exception.SfdcSqlException: ORA-00920: invalid relational operator

Query is :

[Select id,name from ObjectNAME__c where Second_Audit_Required__c= true and Second_Audit_Required__c != null];
Answered by Csaba Toth

ora 00920 problem may be this Salesforce known issue: A formula field with a result of NULL causes SOQL retrieval to fail as it includes the same exception and is about formula fields. Until that is fixed, change your formula to never return null as described in the known issue: Workaround Ensure the formula result is TRUE or FALSE. (Whether or not this is the correct answer, when you get an unexpected message it is usually worth cutting and pasting - so it is an exact copy - the message into Google to see if others have come across it.)



Your Answer

Interviews

Parent Categories