Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Cursor For Loops
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;
Your code is wrong. That's why you don't understand it.
Keywords in upper case. variables in lower case.
DECLARE CURSOR c1 IS
SELECT r.surname, r.cursal, r.born
FROM recruit r
BEGIN
FOR row IN c1 LOOP
IF row.surname='WHATEVER' THEN
END IF;
END LOOP;
END;
--
Tommy Wareing
MIS Group
Learning Resources
Oxford Brookes University
01865 483389
Received on Fri May 22 1998 - 09:19:00 CDT
![]() |
![]() |