Using the Pseudocolumn ROWNUM to Limit Query Results
DECLARE
TYPE sallist IS TABLE OF employees.salary%TYPE;
sals SALLIST;
BEGIN
-- Limit the number of rows to 50
SELECT salary
BULK COLLECT INTO sals
FROM employees
WHERE ROWNUM <= 50;
-- Retrieve 10% (approximately) of the rows in the table
SELECT salary
BULK COLLECT INTO sals
FROM employees SAMPLE ( 10 );
END;
/
0 comments:
Post a Comment