Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return Top N from Oracle SP
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00620360
Message ID:
00620377
Views:
43
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform