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
  • 1
    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. Oct 23, 2013 at 17:17

2 Answers 2


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.

  • 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 Oct 23, 2013 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. Oct 24, 2013 at 17:04

I know this is an older question, but I just ran into a similar issue.

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

IN our case the solution was:

I believe it was related to the logging level I'd enabled on the Developer Console. I was processing thousands of records in my Batch processes and had FINEST level logging enabled for APEX CODE. I changed it to DEBUG level and my jobs started to succeed.

Posted just to give another reason this may be occurring as it could resolve your issue.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .