Returning a reference to a cursor from a function

Поиск
Список
Период
Сортировка
От david williams
Тема Returning a reference to a cursor from a function
Дата
Msg-id DAV374EsURKQaJcrJf00000cd8c@hotmail.com
обсуждение исходный текст
Ответы Re: Returning a reference to a cursor from a function
Список pgsql-sql
To anyone who can help me,
 
I am new at Postgresql and am having some problems.
 
I am trying to return a rowset from a function to the calling procedure.
 
Outside a function I have gotten this to work at the psql level.
 
-------------
BEGIN Work;
    DECLARE Liahona CURSOR FOR Select * from users;
FETCH FORWARD ALL IN Liahona;
CLOSE Liahona;
COMMIT Work;
--------------
 
I went a stage further attempt to put this query into a function as such
 
--------------
CREATE FUNCTION getallusers() RETURN integer AS'
DECLARE
    Liahona CURSOR FOR Select * from users;
BEGIN
 
FETCH FORWARD ALL IN Liahona;
 
CLOSE Liahona;
END;
'language 'plpgsql';
 
---------------
Followed by 'select getallusers();' for testing purposes.
 
I get the error:
 
ERROR during compile of getallusers near line 5
Parse error at or near "FORWARD"
 
I have tried creating RECORD type cursors but no luck.
 
Can anyone suggest how to do this.
 
I was referenced to this this through my discussion at dbforums.com.
 
Thanks

!-------------------------------------!
David Williams


Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

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

Предыдущее
От: Hanno Wiegard
Дата:
Сообщение: Table alias in DELETE statements
Следующее
От: James Orr
Дата:
Сообщение: Re: Latitude / Longitude