Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return Top N from Oracle SP
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00620360
Message ID:
00620377
Vues:
45
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform