>Add WHERE ROWNUM <= N to the select statement.
I saw that option. Sorry, I should have said the SQL contains a GROUP BY and ORDER BY which screw up the use of ROWNUM in that query. How would you modify the package below to open a temp cursor with the original SQL, then select from that cursor with the ROWNUM filter where that is the cursor that is returned? TIA.
CREATE OR REPLACE PACKAGE PkgName AS
Type RetCursor Is Ref Cursor;
Procedure ReturnCursor(pCursor OUT RetCursor);
END;
/
show error
CREATE OR REPLACE PACKAGE BODY PkgBodyname AS
Procedure ReturnCursor(pCursor OUT RetCursor) is
Begin
open pCursor for
SELECT KeyID, COUNT(*) AS Kount
FROM TableName
GROUP BY KeyID
ORDER BY Count(*) DESC;
End;
END;
/
show error
Mark McCasland
Midlothian, TX USA