当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
Oracle指定记录数的奇怪问题查询
发布时间:2009/12/28 16:02:14 来源:www.xue.net 编辑:城市总裁吧
  首先看一段代码:
  dbo.getPreparedStatement(”select * from (select * from Entity_HotLink where hotLinkSortId = ? 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);
  则都能正常查询记录。
  此问题比较奇怪有问题再研究研究。
广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved