From: | Anusha Srinivasan <anusha1932(at)yahoo(dot)co(dot)in> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Question on Cursor |
Date: | 2005-09-20 13:36:51 |
Message-ID: | 20050920133652.57032.qmail@web8506.mail.in.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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
From | Date | Subject | |
---|---|---|---|
Next Message | John DeSoi | 2005-09-20 13:47:34 | Re: Starting PGSQL |
Previous Message | Mike | 2005-09-20 13:29:40 | Re: Starting PGSQL |