A strange problem occurred when querying the specified number of records in Oracle

Source: Internet
Author: User

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:

 
 
  1. dbo.getPreparedStatement
    (”select * from (select * from Entity_HotLink where hotLinkSortId = 
    ? and hotLinkStatus = ? order by hotLinkOrder ASC, lastModifiedDate DESC) where ROWNUM <= ?");  
  2. dbo.pstmt.setInt(1, hotLinkSortId);  
  3. dbo.pstmt.setInt(2, hotLinkStatus);  
  4. 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

 
 
  1. dbo.getPreparedStatement
    (”select * from (select * from Entity_HotLink where hotLinkSortId = 
    ? and hotLinkStatus = ? order by hotLinkOrder ASC, lastModifiedDate DESC) where ROWNUM <= " + count);  
  2. dbo.pstmt.setInt(1, hotLinkSortId);  
  3. 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.