Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Top N in Oracle 8.0.5
Hi,
How do I create a top-N query in Oracle 8.0.5?
The top-N has to happen after sorting the input, but ordered subqueries weren't allowed prior to 8i. All the documentation I've found is related to 8i, still no luck with this version!
INSERT INTO PA_ASSIGN
SELECT * FROM (
SELECT *
FROM PA_SELECT
WHERE code = xPlSqlVariable1
ORDER BY col1, col2, col3
WHERE ROWNUM <= xPlSqlVariable2;
Any hints are greatly appreciated.
Thanks,
Ivan.
Received on Mon Jul 01 2002 - 12:20:19 CDT