SQL statement implementation that limits the number of data queries in ORACLE and SYBASE databases
I. OverviewFor some software that needs to deal with a large amount of data through databases, processing performance is very important. In order to
SQL statement implementation that limits the number of data queries in ORACLE and SYBASE databases. oraclesybase
I. Overview For some software that needs to deal with a large amount of data through databases, processing performance is very
Different databases: oracle mysql SQL Server DB2 infomix sybase paging query statement, infomixsybase
Paging query statements used in different databases:
Current page: currentpagePage size: pagesize
1. Oracle Database
Select * from (select A. *,
I. OverviewFor some software that needs to deal with large amounts of data through a database, processing performance is quite important. In order to ensure that the software can finish all the data without crashing, the idea of batch processing
Paged query statements that are used in different databases:Current page: CurrentPagePage Size: pagesize1. Oracle DatabaseSELECT * FROM (select A.*,rownum rn from (query_sql) A) where Rn (current Page*pagesize)Note: query_sql is a query SQL
Some practical SQL can be written to reduce the complexity of their own programs, and some things can be done by SQL to allow the required data in the RS can be obtained:1. Combine several fields in the database into a single field output:--Main use
Paged query statements that are used in different databases:Current page: CurrentPagePage Size: pagesize1. Oracle DatabaseSELECT * FROM (select A.*,rownum rn from (query_sql) A) where Rn (current Page*pagesize)Note: query_sql is a query SQL
The stored procedure created in oracle is inconsistent with the syntax in sybase and SQL server.
The following example shows how to use stored procedures in different databases.
---------------------------
Oracle:
Create or replace function MY_FUNC
(
Statement 1. ORACLEwww.2cto. comSELECT * statements. INFORMIXSELECTFIRSTN * statements. DB2SELECT * ROW_NUMBER () OVER (ORDERBYCOL1DESC) ASROWNUMWHEREROWNUMN or SELECTCOLUMNFROMT
The statement for the database to take the first few records 1. ORACLE
Creating a stored procedure in oracle is a frequently used function. The following describes the differences between the stored procedure in oracle and other databases. If you are interested, take a look.
The stored procedure created in oracle is
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.