Uploaded image for project: 'Xporter for Jira'
  1. Xporter for Jira
  2. XPORTER-4526

SQLSyntaxErrorException: ORA-01795: maximum number of expressions in a list is 1000

    XporterXMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Medium
    • Resolution: Unresolved
    • Xporter DC 7.4.6
    • Xporter DC 7.4.11
    • Database
    • None
    • DC

    • UNCOVERED

    Description

      The following error is being thrown every hour: SQLSyntaxErrorException: ORA-01795: maximum number of expressions in a list is 1000.

      In Xporter, XporterRepositoryImpl.remove() is the method responsible for deleting old process records from the AO_3C6513_XPORTER_PROCESS table.

      Difference between versions:

      • 7.3.0 (old logic)
      ao.delete(ao.find(clazz, filter));
      
      • This loads all matching rows and deletes them in one go.
      • On Oracle, if more than 1000 IDs are passed, you hit ORA‑01795.
      • 7.4.8 (new logic)
      private static final int BATCH_SIZE = 2000;
      do {
          batch = ao.find(clazz, Query.select()
              .where(filter.getWhereClause(), filter.getWhereParams())
              .limit(BATCH_SIZE));
          if (batch.length > 0) {
              ao.delete(batch);
          }
      } while (batch.length == BATCH_SIZE);
      

      This introduces batch deletion.

      It deletes records in chunks of 2000 until all are gone.

      The comment even mentions “avoid SQL Server limit of 2100 parameters per query,” but ironically Oracle’s limit is stricter (1000).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pmax Paulo Aleixo
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: