Re: Looping thru all records in base block

From: Bob Cunningham <bcunn_at_oanet.com>
Date: Mon, 27 Apr 1998 23:38:05 GMT
Message-ID: <3545140d.91165723_at_news.oanet.com>


On Sat, 25 Apr 1998 22:45:09 +0000, Roger <purirb_at_erols.com> wrote:

>I want to loop through all records in a base block of form
>and do some calculations. Like I would loop thrugh with a
>cursor stmt in PL/SQL. How do I do it? TIA

Something along the lines of the following can be used:

   GO_BLOCK('blockname');
   FIRST_RECORD;
   LOOP

      <whatever you want to do with the current record>
      EXIT WHEN :SYSTEM.Last_Record = 'TRUE';
      NEXT_RECORD;

   END LOOP; Since this requires navigation it can only be performed where navigation is allowed. You'd probably want to enhance this to return the cursor from whence it came and restore the current record in the block being scanned since the above sample leaves the last one as the current record in the block.

HTH Bob Cunningham
bcunn_at_oanet.com Received on Tue Apr 28 1998 - 01:38:05 CEST

Original text of this message