oracle select first row code example
Example 1: oracle select first 10 rows
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
WHERE ROWNUM >= 1 AND ROWNUM <=10;
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
FETCH FIRST 10 ROWS ONLY;
Example 2: oracle first row
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
WHERE ROWNUM = 1;
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
FETCH FIRST 1 ROW ONLY;
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
FETCH FIRST 10 ROW ONLY;
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
FETCH FIRST 10 ROWS ONLY;
Example 3: oracle select first row
select *
from CONSUMERS
where ROWNUM <= 1