+ Start a Discussion
Paras JainParas Jain 

Sometime Execute sucessful , n some time got error, Please help

//First error: SQLException [common.exception.SfdcSqlException: ORA-01013: user requested cancel of current operation
//select /*ApexBatch.Class.DeleteFlatRecords.start: line 13*/ *
from (select "Id"
from (select t.deleted "IsDeleted_gen_1",
global class DeleteFlatRecords implements Database.Batchable<sObject>
     // Start Method
     global Database.QueryLocator start(Database.BatchableContext BC)
     String   Query='select id from flat__C ';
         return Database.getQueryLocator(query);

    // Execute Logic
    global void execute(Database.BatchableContext BC, List<sObject>scope)
        List<Flat__c> flatRecords=new List<Flat__C>();
        for(sObject s: scope)
            flat__C f= (flat__C )s;
        delete flatRecords;      
    global void finish(Database.BatchableContext BC)
      FlatRecords b = new FlatRecords ();
     // system.abortJob(sc.getTriggerId());
Akshay DeshmukhAkshay Deshmukh
I think you are getting time out exception.
If batch job takes to much time, it sometimes gives timeout exception. try with batch size 200.
If you are not getting timeout exception, then please post exception to be able to help you.
Hope it helpes.