Sql Openfire ORA-00907:缺少右括号

Sql Openfire ORA-00907:缺少右括号,sql,oracle11g,oracle12c,openfire,Sql,Oracle11g,Oracle12c,Openfire,从OpenFire监控服务插件检索消息时遇到以下问题。我发现错误是由于数据库中的错误查询造成的,但我仍然无法检测到查询工作不正常的错误 SELECT fromjid, fromjidresource, tojid, tojidresource, sentdate, body, stanza, messageid, barejid FROM ( SELECT DISTINCT ofmessagearchive.fromjid, ofmessagearchive.fromjidresourc

从OpenFire监控服务插件检索消息时遇到以下问题。我发现错误是由于数据库中的错误查询造成的,但我仍然无法检测到查询工作不正常的错误

SELECT
fromjid,
fromjidresource,
tojid,
tojidresource,
sentdate,
body,
stanza,
messageid,
barejid
FROM
(
SELECT
  DISTINCT ofmessagearchive.fromjid,
  ofmessagearchive.fromjidresource,
  ofmessagearchive.tojid,
  ofmessagearchive.tojidresource,
  ofmessagearchive.sentdate,
  ofmessagearchive.body,
  ofmessagearchive.stanza,
  ofmessagearchive.messageid,
  ofconparticipant.barejid
FROM
  ofmessagearchive
  INNER JOIN ofconparticipant ON ofmessagearchive.conversationid = 
ofconparticipant.conversationid
WHERE
  (
    ofmessagearchive.stanza IS NOT NULL
    OR ofmessagearchive.body IS NOT NULL
  )
  AND ofmessagearchive.messageid IS NOT NULL
  AND ofmessagearchive.sentdate >= 0
  AND ofmessagearchive.sentdate <= 1602748770287
  AND ofconparticipant.barejid = 'usuario3@192.168.0.79'
  AND (
    ofmessagearchive.tojid = 'usuario4@192.168.0.79'
    OR ofmessagearchive.fromjid = 'usuario3@192.168.0.79'
  )
ORDER BY
  ofmessagearchive.sentdate DESC
LIMIT
  100
 ) AS part
ORDER BY
sentdate
我在执行以下查询时出错

ORA-00907:缺少右括号

命令行错误:32列:9

Oracle中没有可用的LIMIT关键字,如果您使用的是Oracle 12c,则只能使用FETCH FIRST 100行,而不是它

您不能使用AS为子查询提供别名,并且Oracle无法识别它。因此,您可以完全删除别名,因为您没有在任何地方使用它,或者只删除as并仅保留别名部分,这应该可以


这是一个关于Oracle限制结果集的好方法,您可以随时查看其他可用站点,例如或官方文档。因为您必须使用行号

您有多少,有多少?相同的数字?Oracle有限制吗?