Question on Cursor

Поиск
Список
Период
Сортировка
Искать

Question on Cursor

От:
Anusha Srinivasan <anusha1932@yahoo.co.in>
Дата:
Hi ,

I want to fetch 1000 records at a time from a
relation. Iam using CURSOR for this purpose . I tried
with the following approach, the problem with this is
the first row is stored in temp , but Iam not sure how
to retrieve the info back from that. The following
FETCH ALL leaves the entry which went into temp.
I want to store 1000 records at a time and want to
print it back . Can anybody guide me in this .  
  
drop function reffunc(refcursor);
 
CREATE FUNCTION reffunc(refcursor) RETURNS refcursor
AS '
declare
        temp varchar(2);
BEGIN
        OPEN $1 FOR SELECT * FROM emp;
        fetch $1 into temp;
        RETURN $1;
END;
' LANGUAGE 'plpgsql';
 
BEGIN;
SELECT reffunc('funccursor');
FETCH ALL IN funccursor;
COMMIT;   

Thanks and Regards
Anusha 



		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
FAQ