Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Curious problem iterating through a ref cursor (recordset)
Paul,
You need a fetch statement and a variable(s) defined to fetch the row into... Then use a loop (checking with a %NOTFOUND) to step through the result set.
Example.
Table jobs ( job_id varchar2(10));
DECLARE
TYPE recordset IS REF CURSOR;
lresult recordset;
tjobid jobs.job_id%TYPE;
BEGIN
open lresult for select * from jobs;
loop fetch lresult into tjobid; exit when lresult%NOTFOUND; dbms_output.put_line (tjobid); end loop;
Jim Stern Received on Tue Nov 11 2003 - 07:34:33 CST
![]() |
![]() |