Question on Cursor

Поиск
Список
Период
Сортировка
От Anusha Srinivasan
Тема Question on Cursor
Дата
Msg-id 20050920133652.57032.qmail@web8506.mail.in.yahoo.com
обсуждение исходный текст
Список 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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Mike
Дата:
Сообщение: Re: Starting PGSQL
Следующее
От: John DeSoi
Дата:
Сообщение: Re: Starting PGSQL