diff --git a/lib/core/agent.py b/lib/core/agent.py index 0e0770b01..d133a8485 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -822,7 +822,9 @@ class Agent(object): limitedQuery += " %s" % limitStr elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2): - if " ORDER BY " in limitedQuery and "SELECT " in limitedQuery: + if not " ORDER BY " in limitedQuery: + limitStr = limitStr.replace(") WHERE LIMIT", " ORDER BY 1 ASC) WHERE LIMIT") + elif " ORDER BY " in limitedQuery and "SELECT " in limitedQuery: limitedQuery = limitedQuery[:limitedQuery.index(" ORDER BY ")] if query.startswith("SELECT "):