سؤال

The following query doesn't result in the same answer on HSQLDB (2.3.1 with ORA syntax support set to true) as it does on Oracle.

select max(ID) from (select ID from TRANSACTION where LOAD=2 and ID>=4 order by ID asc) where rownum <=2

Applied to the following dataset

<dataset>
<TRANSACTION ID="2" LOAD="1" />
<TRANSACTION ID="3" LOAD="1" />
<TRANSACTION ID="4" LOAD="2" />
<TRANSACTION ID="5" LOAD="2" />
<TRANSACTION ID="6" LOAD="2" />
<TRANSACTION ID="7" LOAD="2" />
<TRANSACTION ID="8" LOAD="2" />
<TRANSACTION ID="10" LOAD="2" />
<TRANSACTION ID="11" LOAD="2" />
<TRANSACTION ID="12" LOAD="2" />
<TRANSACTION ID="13" LOAD="2" />
<TRANSACTION ID="14" LOAD="2" />
<TRANSACTION ID="15" LOAD="2" />
</dataset>

Oracle returns 5 but HSQLDB reports 15.

هل كانت مفيدة؟

المحلول

Yes, there is a difference here which may be changed in a future version of HSQLDB.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top