Oracle uses the row range query to retrieve 4 to 10 rows and oracle10 rows.

Source: Internet
Author: User

Oracle uses the row range query to retrieve 4 to 10 rows and oracle10 rows.

Rownum cannot be used directly. aliases must be converted after query.

Take the EMP table as an example and take 4 to 10 rows:

Select * from (select rownum id, t. * from emp t) where id between 4 and 10;

If sorting is required, you must handle it as follows:

Select * from (select rownum rn, t. * from (select a. * from eba02 a order by eba003) t where rownum <= 110) where rn> = 110;

How does one query data that is not in a certain range in oracle?

You can use not in or not exist

Oracle queries corresponding data based on the selected time range

Select * from TableA where to_char (startDate, 'yyyy-MM-DD ')> = '2017-09-01' and to_char (endDate, 'yyyy-MM-DD ') <= '2017-09-012 ';
In addition, you can bind parameters in the program to avoid parsing SQL statements every time, which can reduce the query time.

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.