Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am trying to execute a Batch job that is processing around 2 million contacts, I batch Apex whenever I try to execute is throwing an error

First error: SQLException [common.exception.SfdcSqlException: ORA-01013: user requested cancel of current operation

select /*ApexBatch.Class.BatchProcessMerge.start: line 144*/ *
from (select "Id"
from (select /*+ ordered use_nl(t) index(t pkcontact)...

I have changed my query in different ways by adding various Where conditions but still getting the error.

The Query I am using is

Select Id , LastModifiedDate, PIV_Last_Updated_Date__c, Email,EmailAlt__c,LastName,Birthdate from Contact where LastName != 'Unknown'  AND Name LIKE 'a%' order by Email,LastName,Birthdate,LastModifiedDate,PIV_Last_Updated_Date__c

I was actually using null comparison but was told by support that its not recommended, so I remove the nulls from where clause. Still having the same issue.

 Select Id , name,  LastModifiedDate, PIV_Last_Updated_Date__c, Email,EmailAlt__c,LastName,Birthdate from Contact where Name LIKE 'a%' and Email != null and LastName != null and LastName != 'Unknown' and Birthdate != null order by Email,LastName,Birthdate,LastModifiedDate,PIV_Last_Updated_Date__c
share|improve this question
 
I think these are usually caused by timeouts in your Start method. If the query is not complete within a certain amount of time (5 mins i think) it blows up like this. We get this a lot on large data sets. How about removing your filter and checking those criteria in your execute method? Also, try removing the order by. –  Phil Hawthorn Oct 23 at 17:17

1 Answer

Unfortunately if trial and error isn't getting the job done (and it sounds like you've done a good job of that) SFDC support is going to have work through this one with you. That's a pretty low level error (usually you just get an error id and have to contact support to get the actual issue) and seems like something that is significantly broken on the Salesforce side.

Bonus tip - support responds to frustration and urgency. You should consider amplifying your agitation and provide a compelling business case for why this is costing your company $$ and you'll get a quicker response from support.

share|improve this answer
 
I have contacted the support and they asked me to remove != null conditions from Where clause, which I did, but I am still getting the error. Not sure what else I need to. Its weird because, I run the same query in Developer Console and I am getting the results back in less than 20 secs –  logontokartik Oct 23 at 17:02
 
@logontokartik Just a guess but is your batch class an older api version? Dev console runs in the latest api version so maybe upgrading batch will resolve the SFDC bug. –  Greg Grinberg 2 days ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.