Today we are going to talk about the strange problem that occurs when you query the specified number of records in Oracle. First, we will use the relevant code to ask the question to be discussed, the following is a detailed description of the article, hoping to help you in this regard.
First, let's look at a piece of code:
- 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);
Environment 1: windows + oracle 10g normal
Environment 2: Redhat E5.2 64bit + oracle 10g (RAC cluster) query execution, but only 10 records are returned, no matter how large your count is.
Change
- 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);
You can query records normally. This is a strange problem. Study it again.
The above content is a description of the strange problem with the specified number of records in Oracle queries. I hope it will help you in this regard.