Oracle查询指定记录数的奇怪问题

首先看一段代码:

dbo.getPreparedStatement("select * from (select * from Entity_HotLink wherehotLinkSortId = ? and hotLinkStatus = ? order by hotLinkOrder ASC, lastModifiedDate DESC) where ROWNUM <= ?");
dbo.pstmt.setInt(1, hotLinkSortId);
dbo.pstmt.setInt(2, hotLinkStatus);
dbo.pstmt.setInt(3, count);

环境1:windows + oracle 10g 正常
环境2: Redhat E5.2 64bit + oracle 10g(RAC集群) 查询执行,但是返回记录数只有10条,不管你的count有多大。

改成

dbo.getPreparedStatement("select * from (select * from Entity_HotLink where hotLinkSortId = ? and hotLinkStatus = ? order by hotLinkOrder ASC, lastModifiedDate DESC) where ROWNUM <= " + count);
dbo.pstmt.setInt(1, hotLinkSortId);
dbo.pstmt.setInt(2, hotLinkStatus);

则都能正常查询记录。

此问题比较奇怪有问题再研究研究。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>