Re: Setting maximum rows to be selected

From: Evan Yates <yatese_at_ruakura.mafqual.govt.nz>
Date: Tue, 16 Aug 1994 17:00:16
Message-ID: <yatese.2.00110155_at_ruakura.mafqual.govt.nz>


In article <32h6ip$1rn_at_ionews.io.org> negandhi_at_io.org (Neil Negandhi) writes:

>I'm running PowerBuilder Enterprise with an Oracle 7.0 back end. What I
>want to know is if it's possible to limit the number of rows a select
>statement returns. For example, a fairly complex select returns order
>information based on several tables, a sub-select, and use of the
>group by statement. Out of the 100 or so rows returned, I would like to
>display the top 20 orders based on the revenue field (which is derived
>from a group sum expression).

You could use a combination of the retrieverow event and the dbcancel() function. Retrieve rows in the DW and have an instance variable counter increment on each retrieverow event. When it hits 20 do a dbcancel().

Crude, but it works.

Evan

   +------------+\                      | yatese_at_ruakura.mafqual.govt.nz
   | Evan Yates | |                     | Ministry of Agriculture & Fisheries
   +____________+ |   .Sig in the box!  | Ruakura Research Centre
    \\\\\\\\\\\\\\|                     | Hamilton, New Zealand
Received on Tue Aug 16 1994 - 17:00:16 CEST

Original text of this message