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:
00620395
Vues:
43
Thanks. I gotta get out of the VFP SQL limitation mode. I forget that subqueries are allowed in more places in Oracle than they are in VFP. These SPs that return cursors work great for me. However, my tables only have about 60,000 records in them at the most, and we have top flight servers that Oracle is running on.
>>CREATE OR REPLACE PACKAGE PkgName AS
>> Type RetCursor Is Ref Cursor;
>>
>  Procedure ReturnCursor(pCursor OUT RetCursor, nCount IN numeric);
>>
>>END;
>>/
>>show error
>>CREATE OR REPLACE PACKAGE BODY PkgBodyname AS
>>
>  Procedure ReturnCursor(pCursor OUT RetCursor, nCount IN numeric) is
>> Begin
>>  open pCursor for
>     select * from
>>    (SELECT KeyID, COUNT(*) AS Kount
>>	FROM TableName
>>	GROUP BY KeyID
>>	ORDER BY Count(*) DESC)
>     where rownum <= nCount
>> End;
>>END;
>>/
>>show error
>>
>That should work.
>
>BTW, how is the performance of this stuff working for you?
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform