Re: Setting maximum rows to be selected
Date: Sat, 20 Aug 94 18:27:00 -0300
Message-ID: <2aa.588.846%mpcbbs_at_ibase.org.br>
On 17 Aug 94 01:17am, Barry Roomberg wrote to ALL:
BR> Newsgroup: comp.databases.oracle
BR> Organization: -=- Compu-Data * Turnersville, NJ -=-
->> In article <12a.4156.905_at_compudata.com> barry.roomberg_at_compudata.com
->> (Barry Roomberg) writes:
->> >-> display the top 20 orders based on the revenue field (which is
->> >-> derived from a group sum expression).
->> >
BR> What about ordering in descending and setting where rownum <= 20?
It doesn't work anymore! Using Oracle v7, you can index the column with the value and use a hint to the optimizer to get the rownum Ok to make "rownum <= 20". But, once the value come from a group sum expression, you need to make a cursor and make 20 fetchs.
I know a trick to make a simple SQL to get only the top 20, but it's too slow! It's just a puzzle answer, but it's not for real life!
Good luck,
| Carlos Augusto Leite Netto | Voice : +55.192.51.1153 | | Software Design Informatica | Fax : +55.192.54.6518 | | Oracle VAR | e-mail : carlos.netto%mpcbbs_at_ibase.org.br | | Software Development & DBA | FidoNet: 4:801/31 (Carlos Netto) | |---------------------------------------------------------------------------| | Softex 2000 member | Brazil, Sao Paulo state, Campinas city | =============================================================================
- Evaluation copy of Silver Xpress. Day # 57
--- via Silver Xpress V4.01P [NR]
User Name: Carlos Netto - ( %mpcbbs_at_ibase.org.br ) This message was processed by RAuucp from Merlin Systems Inc.
Received on Sat Aug 20 1994 - 23:27:00 CEST