Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Cursor For Loops

Re: Cursor For Loops

From: Tim Hall <tim.hall_at_spam.begone>
Date: Fri, 22 May 1998 11:20:46 GMT
Message-ID: <35655f23.11709756@69.0.9.9>


On Fri, 22 May 1998 11:43:01 +0100, Richard Fairbairn <r.fairbairn_at_zetnet.co.uk> wrote:

>I understand that a cursor for loop is a loop transaction that
>automatically opens a cursor, fetches its contents into a special
>record structure and then closes the cursor. However, can someone
>tell me (using the following example) how the loop determines where
>it will terminate. (I.e., what is the relevance of C1_RECORD).
>
>Here we go...
>
>DECLARE
> CURSOR C1
> IS SELECT R.SURNAME, R.CURSAL, R.BORN FROM RECRUIT R;
>
>BEGIN
> FOR F1 IN F1_RECORD LOOP
> -------------
> IF F1_RECORD.SURNAME = 'WHATEVER'
> THEN and so on and so on ...
>
> END LOOP;
>
>END;
>

It will loop until it can't fetch any more records, i.e. one iteration for each row returned in the query.

  Tim hall
  Indus International

  Email: tim.hall (at) iint.com
  http: //www.indusworld.com Received on Fri May 22 1998 - 06:20:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US