Home » Developer & Programmer » Forms » NEXT record
NEXT record [message #204179] Sat, 18 November 2006 11:36 Go to next message
highvoltage
Messages: 12
Registered: October 2006
Location: Singapore
Junior Member
Cant seems to move to next record guys stays at one record


DECLARE
cursor c1 IS
SELECT stud_id
FROM STUDENT;

BEGIN
OPEN c1;

LOOP
FIRST_RECORD;
FETCH c1 INTO :STUDENT_BLOCK.stud_id;
EXIT WHEN c1%NOTFOUND;
next_record;
END LOOP;
CLOSE c1;
END;
Re: NEXT record [message #204184 is a reply to message #204179] Sat, 18 November 2006 12:27 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you ever try to review code you've written? Obviously not ... having FIRST_RECORD within the loop ALWAYS returns you to the first record.

Move FIRST_RECORD outside the loop (i.e. in front of it).

[EDIT]

Also, shorten the whole code like this:
BEGIN
  first_record;
  FOR cur_r IN (SELECT stud_id FROM student) LOOP
    :student_block.stud_id := cur_r.stud_id;
    next_record;
  END LOOP;
END;

[Updated on: Sat, 18 November 2006 12:29]

Report message to a moderator

Previous Topic: List Item DATE
Next Topic: Programatically press the button
Goto Forum:
  


Current Time: Fri Sep 20 12:31:21 CDT 2024