Did I mention that Oracle SDE sucks? Among other things I hate about it is that it has character limits on the SQL expresions you can pass into it. FGDB is much better in this regard...This probably doesn't help you as I bet you are developing some sort of interactive tool/toolbox or something, but I learned a long while back... Step1 to any ESRI geoprocessing analysis: Copy all the data to a local hard drive (perferably in .shp or FGDB format), then proceed with the analysis (i.e. Don't use data directly from a network connection!).Here's a work around that builds a selection table in SDE#blah blah
    else:
        #Process: Try to select the arcs
        message = "Selecting features. Please wait..."; showPyMessage()
        selectionOidList = list(currentSearchOidList)
        selectionOidList.sort()
        gp.SelectLayerByAttribute_management(inLayer, "NEW_SELECTION", oidFieldName + " in (" + str(selectionOidList)[1:-1] + ")")
        #blah blah
        #blah blah
        #Process: Proceed with getting the selected feature count... if data source is in SDE this can take a while!               
        selectedFeatureCount = int(gp.GetCount_management(inLayer).getoutput(0))
        if selectedFeatureCount > 0:
            message = "Selected " + str(selectedFeatureCount) + " features..."; showPyMessage()
        elif sdeDataSourceFlag == True and selectedFeatureCount == 0 and len(selectionOidList) > 0:
            #Process: Build an SDE look up table to handle the large selection!
            message = "Building ArcSDE selection table. Please wait..."; showPyMessage()
            lookupTblName = "SEL_OID_" + string.lower(os.environ.get("USERNAME")) + "_" + time.strftime('%Y%m%d%H%M%S')
            gp.CreateTable_management("in_memory", lookupTblName, "", "")
            gp.AddField_management("in_memory\\" + lookupTblName, "SEL_OID", "LONG")
            insertRows = gp.insertcursor("in_memory\\" + lookupTblName)
            for currentSearchOid in currentSearchOidList:
                insertRow = insertRows.newrow()
                insertRow.SEL_OID = currentSearchOid
                insertRows.insertrow(insertRow)
            del insertRow
            del insertRows
            parentWorkspace = parentFC[0:-len(parentFC.split("\\")[-1]) - 1] #if stream dataset (aka  "the parent" ) is in SDE put the lut there too
            lookupTblPath = parentWorkspace + "\\" + lookupTblName
            gp.CopyRows_management("in_memory\\" + lookupTblName, lookupTblPath, "")
            gp.Delete_management("in_memory\\" + lookupTblName, "")
            gp.ChangePrivileges_management(lookupTblPath, "public", "GRANT", "GRANT")
            gp.SelectLayerByAttribute_management(inLayer, "NEW_SELECTION", oidFieldName + " in (SELECT SEL_OID FROM " + lookupTblName + ")")
            gp.Delete_management(lookupTblPath, "")         
            message = "Selected " + str(count2) + " features..."; showPyWarning()
        else:
             message = "ERROR: No features were selected! Exiting script..."; showPyError(); sys.exit()
        del currentSearchOidList 
    message = "REFRESH THE ARCMAP VIEW TO DISPLAY NEWLY SELECTED FEATURES!"; showPyWarning()  
    #*****************GEOPROCESSING STUFF ENDS HERE******************************
  
    #Indicates that the script is complete
    message = sys.argv[0] + " is all done!"; showPyMessage()
except:
    message = "Error in script! Consult log file " + logFile + " for details..."; showPyError()
    message = "\n*** LAST GEOPROCESSOR MESSAGE (may not be source of the error)***";  print >> open(logFile, 'a'), str(time.ctime()) + " - " + message
    print >> open(logFile, 'a'), gp.GetMessages()
    message = "PYTHON TRACEBACK INFO: " + traceback.format_tb(sys.exc_info()[2])[0];  print >> open(logFile, 'a'), str(time.ctime()) + " - " + message
    message = "PYTHON ERROR INFO: " +  str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n";  print >> open(logFile, 'a'), str(time.ctime()) + " - " + message
    message = "\n*** PYTHON LOCAL VARIABLE LIST ***"; print >> open(logFile, 'a'), str(time.ctime()) + " - " + message #don't print this mess to ArcToolbox (just the logFile)!
    variableCounter = 0                      
    while variableCounter < len(locals()):
        message =  str(list(locals())[variableCounter]) + " = " + str(locals()[list(locals())[variableCounter]]); print >> open(logFile, 'a'), str(time.ctime()) + " - " + message #don't print this mess to ArcToolbox (just the logFile)!
        variableCounter = variableCounter + 1]