TOP
A TOP clause in a SELECT statement specifies the number of records to return, starting with the first record in the table.
Syntax
SELECT TOP <number> <column_name>
FROM <table>
Remarks
• TOP can improve performance by limiting the number of records returned, especially when very large tables are involved.
• The number argument is an integer representing how many rows to return.
• Use TOP with the ORDER BY clause to make sure your specified number of rows is in a defined order.
Example
PROCEDURE LookupProduct(OUT result CURSOR(ProductDescription VARCHAR(255)))
BEGIN
OPEN result FOR SELECT
TOP 5 products.ProductDescription
FROM /shared/examples/ds_inventory/tutorial/products products;
END