Processing of paging SQL statements

Source: Internet
Author: User
Processing of paging SQL statements
The SQL statement for MySQL to process page flip is relatively simple. It uses limit to start the position and record the number. In PHP, you can also use seek to locate the result.
Set location.
It is complicated for Oracle to process paging SQL statements. Each result set has only one rownum field to indicate its position and can only
Rownum <100, not rownum> 80.
The following two SQL statements (ID is the field name of the unique keyword) are better after analysis ):
Statement 1:
Select ID, [field_name,...] From table_name where ID in (select ID from (select
Rownum as numrow, ID from table_name where Condition 1 order by condition 2) Where numrow> 80 and
Numrow <100) order by Condition 3;

Statement 2:
Select * from (select rownum as numrow, C. * from (select [field_name,...] From
Table_name where Condition 1 order by condition 2) c) Where numrow> 80 and numrow <100) order by Condition 3;

Processing of long strings
Oracle processing of long strings also has some special features. The maximum operable string length during insert and update is less than or equal
4000 single-byte characters. If you want to insert a longer string, use the clob type for the field to borrow dbms_lob from Oracle.Program
Package. Before inserting a modification record, make sure to judge non-null and length. If the field value cannot be blank or the field value exceeding the length is not allowed, a warning should be given,
Returns the last operation.

fuzzy comparison of strings
MySQL uses the field name like '% string %'
oracle can also use the field name like '% string %', but this method cannot be used index, low Speed
use a string to compare the instr function (field name, 'string')> 0 to get more accurate search results

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.