Table of ContentsPreviousNext

Ispirer
Please, note, that Ispirer SQLWays 6.0 is no longer supported and provided to clients.
You can try out automated conversion of databases and applications with Ispirer Toolkit for free. Download free trial.
Check out the relevant toolkit documentation.
Ispirer SQL Server to Oracle Migration overview.


Ispirer SQLWays Database Migration Software

Restricting Number of Rows in Result Set

This subsection describes ways for restricting result sets in various databases and their conversion by SQLWays.

TABLE 35. Restricting Number of Rows in Result Set
Database
Clause
Descriptions
Microsoft SQL Server
TOP n [ PERCENT ]  
The TOP clause of the SELECT statement limits the number of rows returned in the result set.
If PERCENT is not specified, n is the number of rows to return.
If PERCENT is specified, n is the percentage of the result set rows to return. In this case n must be an integer between 0 and 100.
If a SELECT statement that includes TOP also has an ORDER BY clause, the rows to be returned are selected from the ordered result set.
Example: The following example retrieves only first 7 rows from the query:
SELECT TOP 7 col1 FROM tab1
Oracle
ROWNUM 
The ROWNUM pseudo column returns a number starting from 1 which indicates the order in which the row was selected in the result set.
 
ROWNUM can be used to limit the number of rows in the result set.
 
If a SELECT statement contains an ORDER BY clause, ROWNUM is assigned before the sort is done.
 
Example: The following example retrieves only first 7 rows from the query:
SELECT col1 FROM tab1 WHERE ROWNUM<=7;


Table of ContentsPreviousNext
Copyright 1999-2023 Ispirer Systems.
Ispirer and SQLWays are registered trademarks. All other product names may be trademarks of the respective companies.
All rights reserved.