diff --git a/lib/core/agent.py b/lib/core/agent.py index d81d4be83..8ea2ceef9 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -822,8 +822,7 @@ class Agent(object): limitedQuery += " %s" % limitStr elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2): - if " ORDER BY " in limitedQuery and "(SELECT " in limitedQuery: - orderBy = limitedQuery[limitedQuery.index(" ORDER BY "):] + if " ORDER BY " in limitedQuery and "SELECT " in limitedQuery: limitedQuery = limitedQuery[:limitedQuery.index(" ORDER BY ")] if query.startswith("SELECT "): @@ -831,6 +830,7 @@ class Agent(object): limitedQuery = "%s FROM (%s,%s" % (untilFrom, untilFrom.replace(delimiter, ','), limitStr) else: limitedQuery = "%s FROM (SELECT %s,%s" % (untilFrom, ','.join(f for f in field), limitStr) + limitedQuery = limitedQuery % fromFrom limitedQuery += "=%d" % (num + 1) diff --git a/xml/queries.xml b/xml/queries.xml index f6ce92a99..90014e7a6 100644 --- a/xml/queries.xml +++ b/xml/queries.xml @@ -209,7 +209,7 @@ - +