Ejemplo 1: resultados del límite de SQL de Oracle
-- Oracle < 11g
SELECT * FROM ( SELECT * FROM emp ORDER BY sal DESC ) WHERE ROWNUM <= 5;
-- Oracle 12c +
SELECT * FROM emp ORDER BY sal DESC FETCH FIRST 5 ROWS ONLY;
Ejemplo 2: Oracle selecciona las primeras 10 filas
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
WHERE ROWNUM >= 1 AND ROWNUM <=10;
-- Oracle 12c:
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
FETCH FIRST 10 ROWS ONLY;
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)